This may be easy but I'm new to VB
I have set up a form using two sstabs, I have set up textFields on tab 1 that is populated from a databse, all works fine, however I want to add a search facility on the first tab. I have used the code below on a normal form and all works fine, However when I use the code below on the first tab I get a compile error Variable not defined can anyone help.
Private Sub cmdFind_Click()
prompt$ = "Please enter Company ID Number."
'get string to be used in the CompanyID field search
SearchStr$ = InputBox(prompt$, "Customer Search"
Data1.Recordset.Index = "CompanyID" 'use CompanyID
Data1.Recordset.Seek "=", SearchStr$ 'and search
If Data1.Recordset.NoMatch Then 'if no match
Data1.Recordset.MoveFirst 'go to first record
End If
End Sub
I have set up a form using two sstabs, I have set up textFields on tab 1 that is populated from a databse, all works fine, however I want to add a search facility on the first tab. I have used the code below on a normal form and all works fine, However when I use the code below on the first tab I get a compile error Variable not defined can anyone help.
Private Sub cmdFind_Click()
prompt$ = "Please enter Company ID Number."
'get string to be used in the CompanyID field search
SearchStr$ = InputBox(prompt$, "Customer Search"
Data1.Recordset.Index = "CompanyID" 'use CompanyID
Data1.Recordset.Seek "=", SearchStr$ 'and search
If Data1.Recordset.NoMatch Then 'if no match
Data1.Recordset.MoveFirst 'go to first record
End If
End Sub