K
Karen Huynh
Hi
This question was answered by a few people a few months back but
unfortunately its been deleted of the server...so i was hoping that someone
could help me answer it again.
I would like the form to run a specific query when specific options are
selected.
Here i what my code looks like so far:
Private Sub cmdsearch_Click()
Dim db As Database
Dim rst As Recordset
Dim sql As String
Set db = CurrentDb
Me.txtEdate.SetFocus
strEdate = Me.txtEdate.Text
Me.txtSdate.SetFocus
strSdate = Me.txtSdate.Text
If strSdate = "" And strEdate = "" Then
MsgBox "Please enter in the dates", , "Required Information
Missing"
ElseIf strSdate > strEate Then
MsgBox "Please make sure the date is right.", , "Required
information missing"
Else
GoTo searching
End If
searching:
'start looking at specific options
If frmopt.Value = 1 And Me.FrRmtype.Value = 1 Then
sql = "SELECT * FROM roomlist" & _
"WHERE roomtype = 'Single'"
end sub
I'm not sure what to do next. I would like a form to open up with a list
showing all the information matching the sql criteria in a datasheet view.
If anyone, can help, that would be greatly appreciated
Thanks
This question was answered by a few people a few months back but
unfortunately its been deleted of the server...so i was hoping that someone
could help me answer it again.
I would like the form to run a specific query when specific options are
selected.
Here i what my code looks like so far:
Private Sub cmdsearch_Click()
Dim db As Database
Dim rst As Recordset
Dim sql As String
Set db = CurrentDb
Me.txtEdate.SetFocus
strEdate = Me.txtEdate.Text
Me.txtSdate.SetFocus
strSdate = Me.txtSdate.Text
If strSdate = "" And strEdate = "" Then
MsgBox "Please enter in the dates", , "Required Information
Missing"
ElseIf strSdate > strEate Then
MsgBox "Please make sure the date is right.", , "Required
information missing"
Else
GoTo searching
End If
searching:
'start looking at specific options
If frmopt.Value = 1 And Me.FrRmtype.Value = 1 Then
sql = "SELECT * FROM roomlist" & _
"WHERE roomtype = 'Single'"
end sub
I'm not sure what to do next. I would like a form to open up with a list
showing all the information matching the sql criteria in a datasheet view.
If anyone, can help, that would be greatly appreciated
Thanks