Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Combobox question

Discussion in 'Information Technology' started by JOM, Nov 10, 2005.

  1. JOM

    JOM
    Expand Collapse
    Guest

    I have a combobox on my form whose control ssource is from a foreign key ID
    with the ID hidden and the name of the customer shows on the form. I want
    the messagebox that will appear with the Name of customers, but its showing
    the ID instead of the Name how will I take care of this?
     
  2. Loading...

    Similar Threads Forum Date
    Question About GGS Questions and Answers Aug 28, 2016
    Marriage And Discrimination Related Questions Blogs Mar 21, 2016
    Sikhi Questioning Faith Sikh Sikhi Sikhism Mar 3, 2016
    Entering into Sikhism: Questions on Reht Maryada. Blogs Oct 22, 2015
    A question about kes/hair? Blogs Oct 21, 2015

  3. Ofer

    Ofer
    Expand Collapse
    Guest

    You need to set the column number

    Msgbox Me.[ComboName].column(1)

    The column numbers start with 0 for the first column.


    --
    The next line is only relevant to Microsoft''s web-based interface users.
    If I answered your question, please mark it as an answer. It''s useful to
    know that my answer was helpful
    HTH, good luck


    "JOM" wrote:

    > I have a combobox on my form whose control ssource is from a foreign key ID
    > with the ID hidden and the name of the customer shows on the form. I want
    > the messagebox that will appear with the Name of customers, but its showing
    > the ID instead of the Name how will I take care of this?
    >
     
  4. Al Camp

    Al Camp
    Expand Collapse
    Guest

    JOM,
    If you have the ID in the first column , and it's hidden, the customer
    name will "display", but the field really contains the ID.
    Say your combo is cboCustID
    In your message box, try this Prompt...
    "This is " & cboCustID.Column(1)
    combo boxes columns are programatically referred to as 0, 1, 2, 3, etc...
    so the name in the second column would be referred to as .Column(1)
    --
    hth
    Al Camp
    Candia Computer Consulting - Candia NH
    http://home.comcast.net/~cccsolutions

    "JOM" <JOM@discussions.microsoft.com> wrote in message
    news:417FD50B-AA21-491C-9E93-4F7F47E55F07@microsoft.com...
    >I have a combobox on my form whose control ssource is from a foreign key
    >ID
    > with the ID hidden and the name of the customer shows on the form. I want
    > the messagebox that will appear with the Name of customers, but its
    > showing
    > the ID instead of the Name how will I take care of this?
    >
     
  5. JOM

    JOM
    Expand Collapse
    Guest

    I think I have lost you, this is what is going on in continuation to a
    previous reply that you helped me with the other day ie the informative
    messagebox!.....

    the following is the sql statement on my Form
    Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    ItemDescNo_ = '" & Me.ItemDescNo_ & "'")

    then the following is where I would like it to show the Name instead of the
    ID!
    MyStr = MyStr & MyRec![CustomerID]



    "Ofer" wrote:

    > You need to set the column number
    >
    > Msgbox Me.[ComboName].column(1)
    >
    > The column numbers start with 0 for the first column.
    >
    >
    > --
    > The next line is only relevant to Microsoft''s web-based interface users.
    > If I answered your question, please mark it as an answer. It''s useful to
    > know that my answer was helpful
    > HTH, good luck
    >
    >
    > "JOM" wrote:
    >
    > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > with the ID hidden and the name of the customer shows on the form. I want
    > > the messagebox that will appear with the Name of customers, but its showing
    > > the ID instead of the Name how will I take care of this?
    > >
     
  6. JOM

    JOM
    Expand Collapse
    Guest

    I think I have lost you, this is what is going on in continuation to a
    previous reply that someone else helped me with the other day ie the
    informative
    messagebox!.....

    the following is the sql statement on my Form
    Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    ItemDescNo_ = '" & Me.ItemDescNo_ & "'")

    then the following is where I would like it to show the Name instead of the
    ID!
    MyStr = MyStr & MyRec![CustomerID]



    "Al Camp" wrote:

    > JOM,
    > If you have the ID in the first column , and it's hidden, the customer
    > name will "display", but the field really contains the ID.
    > Say your combo is cboCustID
    > In your message box, try this Prompt...
    > "This is " & cboCustID.Column(1)
    > combo boxes columns are programatically referred to as 0, 1, 2, 3, etc...
    > so the name in the second column would be referred to as .Column(1)
    > --
    > hth
    > Al Camp
    > Candia Computer Consulting - Candia NH
    > http://home.comcast.net/~cccsolutions
    >
    > "JOM" <JOM@discussions.microsoft.com> wrote in message
    > news:417FD50B-AA21-491C-9E93-4F7F47E55F07@microsoft.com...
    > >I have a combobox on my form whose control ssource is from a foreign key
    > >ID
    > > with the ID hidden and the name of the customer shows on the form. I want
    > > the messagebox that will appear with the Name of customers, but its
    > > showing
    > > the ID instead of the Name how will I take care of this?
    > >

    >
    >
    >
     
  7. Ofer

    Ofer
    Expand Collapse
    Guest

    Can you post the full code, with the message box that you have now, that
    display the ID?


    "JOM" wrote:

    > I think I have lost you, this is what is going on in continuation to a
    > previous reply that you helped me with the other day ie the informative
    > messagebox!.....
    >
    > the following is the sql statement on my Form
    > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    >
    > then the following is where I would like it to show the Name instead of the
    > ID!
    > MyStr = MyStr & MyRec![CustomerID]
    >
    >
    >
    > "Ofer" wrote:
    >
    > > You need to set the column number
    > >
    > > Msgbox Me.[ComboName].column(1)
    > >
    > > The column numbers start with 0 for the first column.
    > >
    > >
    > > --
    > > The next line is only relevant to Microsoft''s web-based interface users.
    > > If I answered your question, please mark it as an answer. It''s useful to
    > > know that my answer was helpful
    > > HTH, good luck
    > >
    > >
    > > "JOM" wrote:
    > >
    > > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > > with the ID hidden and the name of the customer shows on the form. I want
    > > > the messagebox that will appear with the Name of customers, but its showing
    > > > the ID instead of the Name how will I take care of this?
    > > >
     
  8. Ofer

    Ofer
    Expand Collapse
    Guest

    Now I remember
    Private Sub ItemDescNo__AfterUpdate()

    Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    Set MyDb = CurrentDb
    ' the table name need to have square brackets
    Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    ItemDescNo_ = '" & Me.ItemDescNo_ & "'")

    If Not MyRec.EOF Then
    MyRec.MoveLast
    MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    MyRec.MoveFirst
    While Not MyRec.EOF
    MyStr = MyStr & vbCrLf
    MyStr = MyStr & MyRec![EmplName] & " Showing "
    ===========================================
    ' If you want the Customer name and not the Id then change this field,
    CustomerID, with the field name that has the customer name in it, check the
    table for that
    MyStr = MyStr & MyRec![CustomerID]
    ============================================
    MyRec.MoveNext
    Wend
    MsgBox MyStr
    End If
    End Sub


    --
    The next line is only relevant to Microsoft''s web-based interface users.
    If I answered your question, please mark it as an answer. It''s useful to
    know that my answer was helpful
    HTH, good luck


    "JOM" wrote:

    > Private Sub ItemDescNo__AfterUpdate()
    >
    > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > Set MyDb = CurrentDb
    >
    > Set MyRec = MyDb.OpenRecordset("Select * From Information Tracking Where
    > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    >
    > If Not MyRec.EOF Then
    > MyRec.MoveLast
    > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > MyRec.MoveFirst
    > While Not MyRec.EOF
    > MyStr = MyStr & vbCrLf
    > MyStr = MyStr & MyRec![EmplName] & " Showing"
    > MyStr = MyStr & MyRec![CustomerID]
    > MyRec.MoveNext
    > Wend
    > MsgBox MyStr
    > End If
    > End Sub
    >
    > ***************************************************
    >
    > "Ofer" wrote:
    >
    > > Can you post the full code, with the message box that you have now, that
    > > display the ID?
    > >
    > >
    > > "JOM" wrote:
    > >
    > > > I think I have lost you, this is what is going on in continuation to a
    > > > previous reply that you helped me with the other day ie the informative
    > > > messagebox!.....
    > > >
    > > > the following is the sql statement on my Form
    > > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > >
    > > > then the following is where I would like it to show the Name instead of the
    > > > ID!
    > > > MyStr = MyStr & MyRec![CustomerID]
    > > >
    > > >
    > > >
    > > > "Ofer" wrote:
    > > >
    > > > > You need to set the column number
    > > > >
    > > > > Msgbox Me.[ComboName].column(1)
    > > > >
    > > > > The column numbers start with 0 for the first column.
    > > > >
    > > > >
    > > > > --
    > > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > > know that my answer was helpful
    > > > > HTH, good luck
    > > > >
    > > > >
    > > > > "JOM" wrote:
    > > > >
    > > > > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > > > > with the ID hidden and the name of the customer shows on the form. I want
    > > > > > the messagebox that will appear with the Name of customers, but its showing
    > > > > > the ID instead of the Name how will I take care of this?
    > > > > >
     
  9. JOM

    JOM
    Expand Collapse
    Guest

    Private Sub ItemDescNo__AfterUpdate()

    Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    Set MyDb = CurrentDb

    Set MyRec = MyDb.OpenRecordset("Select * From Information Tracking Where
    ItemDescNo_ = '" & Me.ItemDescNo_ & "'")

    If Not MyRec.EOF Then
    MyRec.MoveLast
    MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    MyRec.MoveFirst
    While Not MyRec.EOF
    MyStr = MyStr & vbCrLf
    MyStr = MyStr & MyRec![EmplName] & " Showing"
    MyStr = MyStr & MyRec![CustomerID]
    MyRec.MoveNext
    Wend
    MsgBox MyStr
    End If
    End Sub

    ***************************************************

    "Ofer" wrote:

    > Can you post the full code, with the message box that you have now, that
    > display the ID?
    >
    >
    > "JOM" wrote:
    >
    > > I think I have lost you, this is what is going on in continuation to a
    > > previous reply that you helped me with the other day ie the informative
    > > messagebox!.....
    > >
    > > the following is the sql statement on my Form
    > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > >
    > > then the following is where I would like it to show the Name instead of the
    > > ID!
    > > MyStr = MyStr & MyRec![CustomerID]
    > >
    > >
    > >
    > > "Ofer" wrote:
    > >
    > > > You need to set the column number
    > > >
    > > > Msgbox Me.[ComboName].column(1)
    > > >
    > > > The column numbers start with 0 for the first column.
    > > >
    > > >
    > > > --
    > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > know that my answer was helpful
    > > > HTH, good luck
    > > >
    > > >
    > > > "JOM" wrote:
    > > >
    > > > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > > > with the ID hidden and the name of the customer shows on the form. I want
    > > > > the messagebox that will appear with the Name of customers, but its showing
    > > > > the ID instead of the Name how will I take care of this?
    > > > >
     
  10. JOM

    JOM
    Expand Collapse
    Guest

    I tried to change it, but customer name is not in my table, what is there is
    Customer ID... Its gives me an error Item not found in this collection!
    that is why I brought up the Freign key!


    "Ofer" wrote:

    > Now I remember
    > Private Sub ItemDescNo__AfterUpdate()
    >
    > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > Set MyDb = CurrentDb
    > ' the table name need to have square brackets
    > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    >
    > If Not MyRec.EOF Then
    > MyRec.MoveLast
    > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > MyRec.MoveFirst
    > While Not MyRec.EOF
    > MyStr = MyStr & vbCrLf
    > MyStr = MyStr & MyRec![EmplName] & " Showing "
    > ===========================================
    > ' If you want the Customer name and not the Id then change this field,
    > CustomerID, with the field name that has the customer name in it, check the
    > table for that
    > MyStr = MyStr & MyRec![CustomerID]
    > ============================================
    > MyRec.MoveNext
    > Wend
    > MsgBox MyStr
    > End If
    > End Sub
    >
    >
    > --
    > The next line is only relevant to Microsoft''s web-based interface users.
    > If I answered your question, please mark it as an answer. It''s useful to
    > know that my answer was helpful
    > HTH, good luck
    >
    >
    > "JOM" wrote:
    >
    > > Private Sub ItemDescNo__AfterUpdate()
    > >
    > > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > > Set MyDb = CurrentDb
    > >
    > > Set MyRec = MyDb.OpenRecordset("Select * From Information Tracking Where
    > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > >
    > > If Not MyRec.EOF Then
    > > MyRec.MoveLast
    > > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > > MyRec.MoveFirst
    > > While Not MyRec.EOF
    > > MyStr = MyStr & vbCrLf
    > > MyStr = MyStr & MyRec![EmplName] & " Showing"
    > > MyStr = MyStr & MyRec![CustomerID]
    > > MyRec.MoveNext
    > > Wend
    > > MsgBox MyStr
    > > End If
    > > End Sub
    > >
    > > ***************************************************
    > >
    > > "Ofer" wrote:
    > >
    > > > Can you post the full code, with the message box that you have now, that
    > > > display the ID?
    > > >
    > > >
    > > > "JOM" wrote:
    > > >
    > > > > I think I have lost you, this is what is going on in continuation to a
    > > > > previous reply that you helped me with the other day ie the informative
    > > > > messagebox!.....
    > > > >
    > > > > the following is the sql statement on my Form
    > > > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > > >
    > > > > then the following is where I would like it to show the Name instead of the
    > > > > ID!
    > > > > MyStr = MyStr & MyRec![CustomerID]
    > > > >
    > > > >
    > > > >
    > > > > "Ofer" wrote:
    > > > >
    > > > > > You need to set the column number
    > > > > >
    > > > > > Msgbox Me.[ComboName].column(1)
    > > > > >
    > > > > > The column numbers start with 0 for the first column.
    > > > > >
    > > > > >
    > > > > > --
    > > > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > > > know that my answer was helpful
    > > > > > HTH, good luck
    > > > > >
    > > > > >
    > > > > > "JOM" wrote:
    > > > > >
    > > > > > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > > > > > with the ID hidden and the name of the customer shows on the form. I want
    > > > > > > the messagebox that will appear with the Name of customers, but its showing
    > > > > > > the ID instead of the Name how will I take care of this?
    > > > > > >
     
  11. Ofer

    Ofer
    Expand Collapse
    Guest

    Where can you find the customer name?
    Use a dlookup to retrive the name from there

    MyStr = MyStr & DLookUp("[Customer Name]", "[Table Name]", "[CustomerID] = "
    & MyRec![CustomerID])


    "JOM" wrote:

    > I tried to change it, but customer name is not in my table, what is there is
    > Customer ID... Its gives me an error Item not found in this collection!
    > that is why I brought up the Freign key!
    >
    >
    > "Ofer" wrote:
    >
    > > Now I remember
    > > Private Sub ItemDescNo__AfterUpdate()
    > >
    > > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > > Set MyDb = CurrentDb
    > > ' the table name need to have square brackets
    > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > >
    > > If Not MyRec.EOF Then
    > > MyRec.MoveLast
    > > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > > MyRec.MoveFirst
    > > While Not MyRec.EOF
    > > MyStr = MyStr & vbCrLf
    > > MyStr = MyStr & MyRec![EmplName] & " Showing "
    > > ===========================================
    > > ' If you want the Customer name and not the Id then change this field,
    > > CustomerID, with the field name that has the customer name in it, check the
    > > table for that
    > > MyStr = MyStr & MyRec![CustomerID]
    > > ============================================
    > > MyRec.MoveNext
    > > Wend
    > > MsgBox MyStr
    > > End If
    > > End Sub
    > >
    > >
    > > --
    > > The next line is only relevant to Microsoft''s web-based interface users.
    > > If I answered your question, please mark it as an answer. It''s useful to
    > > know that my answer was helpful
    > > HTH, good luck
    > >
    > >
    > > "JOM" wrote:
    > >
    > > > Private Sub ItemDescNo__AfterUpdate()
    > > >
    > > > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > > > Set MyDb = CurrentDb
    > > >
    > > > Set MyRec = MyDb.OpenRecordset("Select * From Information Tracking Where
    > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > >
    > > > If Not MyRec.EOF Then
    > > > MyRec.MoveLast
    > > > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > > > MyRec.MoveFirst
    > > > While Not MyRec.EOF
    > > > MyStr = MyStr & vbCrLf
    > > > MyStr = MyStr & MyRec![EmplName] & " Showing"
    > > > MyStr = MyStr & MyRec![CustomerID]
    > > > MyRec.MoveNext
    > > > Wend
    > > > MsgBox MyStr
    > > > End If
    > > > End Sub
    > > >
    > > > ***************************************************
    > > >
    > > > "Ofer" wrote:
    > > >
    > > > > Can you post the full code, with the message box that you have now, that
    > > > > display the ID?
    > > > >
    > > > >
    > > > > "JOM" wrote:
    > > > >
    > > > > > I think I have lost you, this is what is going on in continuation to a
    > > > > > previous reply that you helped me with the other day ie the informative
    > > > > > messagebox!.....
    > > > > >
    > > > > > the following is the sql statement on my Form
    > > > > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > > > >
    > > > > > then the following is where I would like it to show the Name instead of the
    > > > > > ID!
    > > > > > MyStr = MyStr & MyRec![CustomerID]
    > > > > >
    > > > > >
    > > > > >
    > > > > > "Ofer" wrote:
    > > > > >
    > > > > > > You need to set the column number
    > > > > > >
    > > > > > > Msgbox Me.[ComboName].column(1)
    > > > > > >
    > > > > > > The column numbers start with 0 for the first column.
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > > > > know that my answer was helpful
    > > > > > > HTH, good luck
    > > > > > >
    > > > > > >
    > > > > > > "JOM" wrote:
    > > > > > >
    > > > > > > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > > > > > > with the ID hidden and the name of the customer shows on the form. I want
    > > > > > > > the messagebox that will appear with the Name of customers, but its showing
    > > > > > > > the ID instead of the Name how will I take care of this?
    > > > > > > >
     
  12. JOM

    JOM
    Expand Collapse
    Guest

    Thanks alot that worked perfect!

    "Ofer" wrote:

    > Where can you find the customer name?
    > Use a dlookup to retrive the name from there
    >
    > MyStr = MyStr & DLookUp("[Customer Name]", "[Table Name]", "[CustomerID] = "
    > & MyRec![CustomerID])
    >
    >
    > "JOM" wrote:
    >
    > > I tried to change it, but customer name is not in my table, what is there is
    > > Customer ID... Its gives me an error Item not found in this collection!
    > > that is why I brought up the Freign key!
    > >
    > >
    > > "Ofer" wrote:
    > >
    > > > Now I remember
    > > > Private Sub ItemDescNo__AfterUpdate()
    > > >
    > > > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > > > Set MyDb = CurrentDb
    > > > ' the table name need to have square brackets
    > > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > >
    > > > If Not MyRec.EOF Then
    > > > MyRec.MoveLast
    > > > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > > > MyRec.MoveFirst
    > > > While Not MyRec.EOF
    > > > MyStr = MyStr & vbCrLf
    > > > MyStr = MyStr & MyRec![EmplName] & " Showing "
    > > > ===========================================
    > > > ' If you want the Customer name and not the Id then change this field,
    > > > CustomerID, with the field name that has the customer name in it, check the
    > > > table for that
    > > > MyStr = MyStr & MyRec![CustomerID]
    > > > ============================================
    > > > MyRec.MoveNext
    > > > Wend
    > > > MsgBox MyStr
    > > > End If
    > > > End Sub
    > > >
    > > >
    > > > --
    > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > know that my answer was helpful
    > > > HTH, good luck
    > > >
    > > >
    > > > "JOM" wrote:
    > > >
    > > > > Private Sub ItemDescNo__AfterUpdate()
    > > > >
    > > > > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > > > > Set MyDb = CurrentDb
    > > > >
    > > > > Set MyRec = MyDb.OpenRecordset("Select * From Information Tracking Where
    > > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > > >
    > > > > If Not MyRec.EOF Then
    > > > > MyRec.MoveLast
    > > > > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > > > > MyRec.MoveFirst
    > > > > While Not MyRec.EOF
    > > > > MyStr = MyStr & vbCrLf
    > > > > MyStr = MyStr & MyRec![EmplName] & " Showing"
    > > > > MyStr = MyStr & MyRec![CustomerID]
    > > > > MyRec.MoveNext
    > > > > Wend
    > > > > MsgBox MyStr
    > > > > End If
    > > > > End Sub
    > > > >
    > > > > ***************************************************
    > > > >
    > > > > "Ofer" wrote:
    > > > >
    > > > > > Can you post the full code, with the message box that you have now, that
    > > > > > display the ID?
    > > > > >
    > > > > >
    > > > > > "JOM" wrote:
    > > > > >
    > > > > > > I think I have lost you, this is what is going on in continuation to a
    > > > > > > previous reply that you helped me with the other day ie the informative
    > > > > > > messagebox!.....
    > > > > > >
    > > > > > > the following is the sql statement on my Form
    > > > > > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > > > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > > > > >
    > > > > > > then the following is where I would like it to show the Name instead of the
    > > > > > > ID!
    > > > > > > MyStr = MyStr & MyRec![CustomerID]
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > > "Ofer" wrote:
    > > > > > >
    > > > > > > > You need to set the column number
    > > > > > > >
    > > > > > > > Msgbox Me.[ComboName].column(1)
    > > > > > > >
    > > > > > > > The column numbers start with 0 for the first column.
    > > > > > > >
    > > > > > > >
    > > > > > > > --
    > > > > > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > > > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > > > > > know that my answer was helpful
    > > > > > > > HTH, good luck
    > > > > > > >
    > > > > > > >
    > > > > > > > "JOM" wrote:
    > > > > > > >
    > > > > > > > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > > > > > > > with the ID hidden and the name of the customer shows on the form. I want
    > > > > > > > > the messagebox that will appear with the Name of customers, but its showing
    > > > > > > > > the ID instead of the Name how will I take care of this?
    > > > > > > > >
     
  13. Ofer

    Ofer
    Expand Collapse
    Guest

    Your welcome
    Glad I could help

    --
    The next line is only relevant to Microsoft''s web-based interface users.
    If I answered your question, please mark it as an answer. It''s useful to
    know that my answer was helpful
    HTH, good luck


    "JOM" wrote:

    > Thanks alot that worked perfect!
    >
    > "Ofer" wrote:
    >
    > > Where can you find the customer name?
    > > Use a dlookup to retrive the name from there
    > >
    > > MyStr = MyStr & DLookUp("[Customer Name]", "[Table Name]", "[CustomerID] = "
    > > & MyRec![CustomerID])
    > >
    > >
    > > "JOM" wrote:
    > >
    > > > I tried to change it, but customer name is not in my table, what is there is
    > > > Customer ID... Its gives me an error Item not found in this collection!
    > > > that is why I brought up the Freign key!
    > > >
    > > >
    > > > "Ofer" wrote:
    > > >
    > > > > Now I remember
    > > > > Private Sub ItemDescNo__AfterUpdate()
    > > > >
    > > > > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > > > > Set MyDb = CurrentDb
    > > > > ' the table name need to have square brackets
    > > > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > > >
    > > > > If Not MyRec.EOF Then
    > > > > MyRec.MoveLast
    > > > > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > > > > MyRec.MoveFirst
    > > > > While Not MyRec.EOF
    > > > > MyStr = MyStr & vbCrLf
    > > > > MyStr = MyStr & MyRec![EmplName] & " Showing "
    > > > > ===========================================
    > > > > ' If you want the Customer name and not the Id then change this field,
    > > > > CustomerID, with the field name that has the customer name in it, check the
    > > > > table for that
    > > > > MyStr = MyStr & MyRec![CustomerID]
    > > > > ============================================
    > > > > MyRec.MoveNext
    > > > > Wend
    > > > > MsgBox MyStr
    > > > > End If
    > > > > End Sub
    > > > >
    > > > >
    > > > > --
    > > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > > know that my answer was helpful
    > > > > HTH, good luck
    > > > >
    > > > >
    > > > > "JOM" wrote:
    > > > >
    > > > > > Private Sub ItemDescNo__AfterUpdate()
    > > > > >
    > > > > > Dim MyDb As Dao.Database, MyRec As Dao.Recordset, MyStr As String
    > > > > > Set MyDb = CurrentDb
    > > > > >
    > > > > > Set MyRec = MyDb.OpenRecordset("Select * From Information Tracking Where
    > > > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > > > >
    > > > > > If Not MyRec.EOF Then
    > > > > > MyRec.MoveLast
    > > > > > MyStr = Me.ItemDescNo_ & " Has " & MyRec.RecordCount & " Users"
    > > > > > MyRec.MoveFirst
    > > > > > While Not MyRec.EOF
    > > > > > MyStr = MyStr & vbCrLf
    > > > > > MyStr = MyStr & MyRec![EmplName] & " Showing"
    > > > > > MyStr = MyStr & MyRec![CustomerID]
    > > > > > MyRec.MoveNext
    > > > > > Wend
    > > > > > MsgBox MyStr
    > > > > > End If
    > > > > > End Sub
    > > > > >
    > > > > > ***************************************************
    > > > > >
    > > > > > "Ofer" wrote:
    > > > > >
    > > > > > > Can you post the full code, with the message box that you have now, that
    > > > > > > display the ID?
    > > > > > >
    > > > > > >
    > > > > > > "JOM" wrote:
    > > > > > >
    > > > > > > > I think I have lost you, this is what is going on in continuation to a
    > > > > > > > previous reply that you helped me with the other day ie the informative
    > > > > > > > messagebox!.....
    > > > > > > >
    > > > > > > > the following is the sql statement on my Form
    > > > > > > > Set MyRec = MyDb.OpenRecordset("Select * From [Information Tracking] Where
    > > > > > > > ItemDescNo_ = '" & Me.ItemDescNo_ & "'")
    > > > > > > >
    > > > > > > > then the following is where I would like it to show the Name instead of the
    > > > > > > > ID!
    > > > > > > > MyStr = MyStr & MyRec![CustomerID]
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > > > "Ofer" wrote:
    > > > > > > >
    > > > > > > > > You need to set the column number
    > > > > > > > >
    > > > > > > > > Msgbox Me.[ComboName].column(1)
    > > > > > > > >
    > > > > > > > > The column numbers start with 0 for the first column.
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > --
    > > > > > > > > The next line is only relevant to Microsoft''s web-based interface users.
    > > > > > > > > If I answered your question, please mark it as an answer. It''s useful to
    > > > > > > > > know that my answer was helpful
    > > > > > > > > HTH, good luck
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > "JOM" wrote:
    > > > > > > > >
    > > > > > > > > > I have a combobox on my form whose control ssource is from a foreign key ID
    > > > > > > > > > with the ID hidden and the name of the customer shows on the form. I want
    > > > > > > > > > the messagebox that will appear with the Name of customers, but its showing
    > > > > > > > > > the ID instead of the Name how will I take care of this?
    > > > > > > > > >
     

Share This Page