Hi all,
I have a form which shows information of each product. There is also a DataCombo control - I want it to be a product finder - if the user picks a product code in the list, the program will "jump" to the corresponding record. At first I thought this can be done by setting the source of the DataCombo to be Product Code; but in the actual run only the DataCombo itself changed but nothing happens to the record position, now the DataCombo shows the Product Code you pick, while all other controls still display data of the previous product. Then I wrote the following code. Its idea is to match product codes between the recordset and the DataCombo:
Private Sub XDataCombo_Change()
XRecordset.Find ("XRecordset.Fields('ProductCode').Value = XDataCombo.Text", , adSearchForward)
End Sub
(Please beware single-column in the code; documents said that Find method does not allow more then 1 pair of double-columns)
Although I followed the instructions in the reference books about using Find method, this code simply doesn’t work (runtime error 3001). Could anyone please kindly point out the problem. Also can someone tell me SQL can do the job. According to my knowledge of SQL (still very weak) I think SQL can only filter certain record(s) from the recordset but not “jumping” to a certain record?
I have a form which shows information of each product. There is also a DataCombo control - I want it to be a product finder - if the user picks a product code in the list, the program will "jump" to the corresponding record. At first I thought this can be done by setting the source of the DataCombo to be Product Code; but in the actual run only the DataCombo itself changed but nothing happens to the record position, now the DataCombo shows the Product Code you pick, while all other controls still display data of the previous product. Then I wrote the following code. Its idea is to match product codes between the recordset and the DataCombo:
Private Sub XDataCombo_Change()
XRecordset.Find ("XRecordset.Fields('ProductCode').Value = XDataCombo.Text", , adSearchForward)
End Sub
(Please beware single-column in the code; documents said that Find method does not allow more then 1 pair of double-columns)
Although I followed the instructions in the reference books about using Find method, this code simply doesn’t work (runtime error 3001). Could anyone please kindly point out the problem. Also can someone tell me SQL can do the job. According to my knowledge of SQL (still very weak) I think SQL can only filter certain record(s) from the recordset but not “jumping” to a certain record?