Hi everyone, many thanks for the help on the last few items. Mistakes and face-palms on my part.
This one is truly perplexing me.
I have a simple form in which I enter in search parameters to search a particular table. The table is tbl_Log_Pages. Ordinarily I would simply add a control source to the form from the get go, but in this case, for what ever reason, when I add the control source I get Run Time error 3008 and the whole thing stops at the last line of code.
So I went back and removed the control source, but now I wish to utilize the WHERE condition. I have 4 variables which I will be utilizing as search parameters. You can see them in the code below.
My issue is how to use the WHERE condition as there is no control table linked to the Search form to reference. I understand using the field names of the table, but if the form doesn't have a control table to reference to begin with, the field names are all but useless anyway because the code has no place to look.
It occurs to me that I might be able to put the table to search in the code, but I can find no examples of this to begin with.
Any suggestions or even a reference to fall back onto. I'm actually very close to getting real results if I can figure out just a few more items, I think I may have it.
This one is truly perplexing me.
I have a simple form in which I enter in search parameters to search a particular table. The table is tbl_Log_Pages. Ordinarily I would simply add a control source to the form from the get go, but in this case, for what ever reason, when I add the control source I get Run Time error 3008 and the whole thing stops at the last line of code.
So I went back and removed the control source, but now I wish to utilize the WHERE condition. I have 4 variables which I will be utilizing as search parameters. You can see them in the code below.
Code:
Private Sub cmd_search_Click()
Dim t As String 'Tail number variable
Dim l As String 'Log page type variable
Dim s As String 'Status variable
Dim v As String 'Severity variable
If IsNull(Me.txt_tail) Then
t = "*" 'If no value is given make wildcard
Else
t = Me.txt_tail.Value
End If
If IsNull(Me.cmb_type) Then
l = "*" 'If no value is given make wildcard
Else
l = Me.cmb_type.Value
End If
If IsNull(Me.cmb_status) Then
s = "*" 'If no value is given make wildcard
Else
s = Me.cmb_status.Value
End If
If IsNull(Me.cmb_sev) Then
v = "*" 'If no value is given make wildcard
Else
v = Me.cmb_sev.Value
End If
MsgBox ("The Search string is Tail = " & t & " Type = " & l & " Status = " & s & " Severity = " & v) 'Test the string
DoCmd.Close
DoCmd.OpenForm "frm_Log_Results", acNormal
End Sub
My issue is how to use the WHERE condition as there is no control table linked to the Search form to reference. I understand using the field names of the table, but if the form doesn't have a control table to reference to begin with, the field names are all but useless anyway because the code has no place to look.
It occurs to me that I might be able to put the table to search in the code, but I can find no examples of this to begin with.
Any suggestions or even a reference to fall back onto. I'm actually very close to getting real results if I can figure out just a few more items, I think I may have it.