Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenate Combo Box in Recordset field 1

Status
Not open for further replies.

tomhughes

Vendor
Aug 8, 2001
233
US
I am trying to concatenate the value of Combo1 into the recordset field. The Combo1 box contains the letters A,B,C,D.... When the program executes, it doesn't get the value of the item in the combo box but the position. i.e. 1,2,3,. How do I get it to recognize the value of each position in the combo box ??? Here is the code I am using.

Code:
Private Sub Combo1_AfterUpdate()
Dim db As DAO.Database, rst As DAO.Recordset, strSQL As String
Set db = CurrentDb
Set rst = db.OpenRecordset("TableName")
Me.TextBox = rst("TopicHead" & Me.Combo1.Value)
End Sub
 
Hi Tom,

Try:

me.combo1.column(1)
or
me.combo1.column(0)

Sounds like you have 2 columns in your combo.
.column(0) is the first column, .column(1) the 2nd etc.

Regards,

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Have a look at the BoundColumn property of combo1.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Darrylles
I have two columns. The first column is the ID autonumber column which I don't really need, the second column is the data which is A,B,C, etc. I have this code in the Combo1_Update section. I tried changing the code to :

Me.TextBox = rst("TopicHead" & Me.Combo1.Column(1).value),

but it still doesn't recognize the record. If I hard code the name of the field in, the code works.

What do I need to do to make it work ???
 
Tom,

Don't use .value.


Regards,

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top