Combobox question

G

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?
 
G

Guest

You need to set the column number

Msgbox Me.[ComboName].column(1)

The column numbers start with 0 for the first column.
 
A

Al Camp

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)
 
G

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 said:
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 said:
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?
 
G

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]
 
G

Guest

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


JOM said:
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 said:
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 said:
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?
 
G

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 said:
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 said:
Can you post the full code, with the message box that you have now, that
display the ID?


JOM said:
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]



:

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


:

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?
 
G

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 said:
Can you post the full code, with the message box that you have now, that
display the ID?


JOM said:
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 said:
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


:

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?
 
G

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 said:
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 said:
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 said:
Can you post the full code, with the message box that you have now, that
display the ID?


:

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]



:

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


:

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?
 
G

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 said:
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 said:
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 said:
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

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

:

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


:

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]



:

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


:

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?
 
G

Guest

Thanks alot that worked perfect!

Ofer said:
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 said:
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 said:
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


:

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

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

:

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


:

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]



:

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


:

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?
 
G

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 said:
Thanks alot that worked perfect!

Ofer said:
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 said:
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!


:

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


:

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

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

:

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


:

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]



:

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


:

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top