I have a program written in Visual Basic 6.0. I have to do a search to retrieve a record. The program uses an access database to store and retrieve the information from. I am using data controls and the findfirst method to retrieve the records...i know there is a better way than using data controls but I dont want to re-write the program.
My problem is that I need to do a search on two fields from my visual basic form - Company and Name. I can get the search to work based on one of the fields but not with a combination of the two. Here is an example of how it works for one:
datContact.Recordset.FindFirst "Name = '" & lstName.Text & "'"
If anyone could tell me how to combine this with a search on the Company please le me know.
The second problem I have with the FindFirst method is searching for a string with an apostrophe in the name - eg. O'Neil. It always gives me a type mismatch error. I think it is just a problem with the syntax of the apostrophes please help me out.
datContact.Recordset.FindFirst "Name = '" & lstName.Text & "'"
Thanks Guys...
My problem is that I need to do a search on two fields from my visual basic form - Company and Name. I can get the search to work based on one of the fields but not with a combination of the two. Here is an example of how it works for one:
datContact.Recordset.FindFirst "Name = '" & lstName.Text & "'"
If anyone could tell me how to combine this with a search on the Company please le me know.
The second problem I have with the FindFirst method is searching for a string with an apostrophe in the name - eg. O'Neil. It always gives me a type mismatch error. I think it is just a problem with the syntax of the apostrophes please help me out.
datContact.Recordset.FindFirst "Name = '" & lstName.Text & "'"
Thanks Guys...