Using DoCMD.FindRecord getting runtime error 2162
Posted on 2006-04-16
I have a form on which there is a combo box, which gets its data from a number field in a table, which has been sorted distinctly into descending order. What I want to be able to do is if the user changes the combo box number to something else then it moves to that record.
The code I wrote looks like this:
Private Sub Shipment_Number_Change()
Dim ShipmentNumber As Integer
ShipmentNumber = [Shipment Number].Value
I put the debug.print in there so I could check that the code correctly gets the right number (which it does), but because the control is not bound to anything I believe this is my problem.
So, here's my problem. I want to get distinct values into a combo box (I have already managed this bit) from a table, and if the user changes the combo box, find the first occurance of that record in a table called ChillOrders.
I am somewhat mystified why I cannot bind the combo box to the table (the field is called "ShipmentNumber"), and having written this sort of thing many times before in MSSQL I can't see why this cannot simply be done.
Anyone got any suggestions?