Hello to all. I have this issue here that was solved yesterday but it still is puzzling me a little bit.
The guys were great so here is what I am wanting that's not quite happened yet.
I have an option group box called "ogFind". In the 3 options in the Option Group, 0=All records, 1=find by ID, and 2=Find by name.
I have a regular command button to run Query1. I do not have any parameters in the criteria field in the query due to it being in the SQL. In other words, it's not attached to the form in any way. I do not have the Like "*" & [Forms]![Form1]![Text1] & "*" in any of the criteria fields. This is one of the things I'm not sure about.
I have an unbound textbox called "text1". In the "after update" command code I have the attached code.
It still seems it doesn't work. Even if there is text in the textbox and I have "All Records" chosen, shouldn't it still bring up all records? When I choose Option 1 or Option 2, it doesn't seem to be attaching itself to the combo box, in other words, no matter what I choose in the Option group, it still gives me the same results.
I am trying to get the user to type in something in the textbox and have the query find it then display the results based on the option they have chosen.
Any more help would be awesome!
Private Sub Text1_AfterUpdate()
Select Case ogFind
Case Is = 0
vSQL = "SELECT * FROM table1;"
Case Is = 1
vSQL = "SELECT * FROM table1 where ID = " & text1 & ";"
Case Is = 2
vSQL = "SELECT * FROM table1 WHERE Name1 LIKE " & Chr(34) & "*" & Me.text1 & "*" & Chr(34)
Me.RecordSource = vSQL