combobox column property problem

zarcoff

New member
Local time
Today, 03:55
Joined
Oct 29, 2014
Messages
5
Hi All,

I am trying to populate a 2 column combobox with the content of a record from a recordset. The user selects the relevant button on a sub form and the main form populates with the selection. For some reason I keep betting errors and I just don't know why. Can anyone help the debugger falls over on the line where I'm trying to display the contents of the recordset.

Code:
Private Sub btnSelectSlot_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim strSQL As String


Set db = CurrentDb
strSQL = "select * from tblSiteDeploymentSlots where deploymentslotid = " & Me.txtDeploymentSlotID & ";"

Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)

Forms!frmAssignDeploymentSlotToSite.cbxCodeName.Column(1) = Left(rs![Site Name], 5)



Set rs = Nothing
Set db = Nothing

End Sub

Any help would be gratefully received!!

Zar!
 
I have changed the combobox to a single column combobox and it seems to be fine without the column property. Not sure why it was set to 2 column combobox in the first place. So I have it working thanks if you've looked this and thought about it.
 

Users who are viewing this thread

Back
Top Bottom