Access 2007, Not compiled, not split, Windows 7, Moderate VBA and Access skills.
I have a main Customer form with a combo box. The combo box was created by the wizard. You select the Customer Name from the combo box and the corresponding record is populated on the main form. The wizard created the macro for the combobox. The macro is as follows:
SearchForRecord, , First, ="[CustomerID] = " & Str(Nz(Screen.ActiveControl,0))
RecordSource = SELECT tbl_customers.customerID, tbl_customers.customername FROM tbl_customers ORDER BY tbl_customers.customername;
The combobox is unbound.
I would like to convert this SearchForRecord macro over to VBA so I have better control over what happens. None of my four attempts work. I can't figure what I am doing wrong.
Can anyone help?
- DoCmd.SearchForRecord , , acFirst, "[CustomerID] = '" & Me.Combo80.Column(0) & "'"
- DoCmd.SearchForRecord , , acFirst, "[CustomerID] = '" & ActiveControl.Combo80.Column(0) & "'"
- DoCmd.SearchForRecord , , acFirst, "[CustomerID] = " & Str(Nz(Screen.ActiveControl, 0)) & "'"
- DoCmd.SearchForRecord acActiveDataObject, , acFirst, "[CustomerID] = '" & Me.Combo80.Column(0) & "'"
Thanks Phred