I MUST do it this way, please help me figure out how.
I know there's a way to create a module or use querydefs or something but I'm new enough that this will be the first time I've attempted this.
I need to run a parameter query using the SQL string as created in the vba sub (used as the record source for a form.
The value for the query's parameter needs to be stored and accessed later in the same sub to filter the results of a combo box to the same recordset.
Private Sub cmdWellByLease_Click()
Dim Str As String
Str = "SELECT WRDB_WELLDATASHEETFINAL.* FROM WRDB_WELLDATASHEETFINAL WHERE (WRDB_WELLDATASHEETFINAL.WELLNAME like [Enter Beginning of Lease Name] & ""*"");"
DoCmd.OpenForm "frmWellDataSheet", acNormal, Str, , acFormEdit, acWindowNormal
'unhide WFLAC objects (requery command button and combo box)
Forms!frmWellDataSheet!cmdRequery.Visible = True
Forms!frmWellDataSheet!OtherSearch.Visible = True
'Set filter for the combo box as the same parameter as given by the user above in the parameter query
Forms!frmWellDataSheet!OtherSearch.RowSource = Str