Expand|Select|Wrap|Line Numbers
- Private Sub CmdSubmit_Click()
- Dim db As DAO.Database
- Dim qdf As DAO.QueryDef
- Dim strSQL As String
- Dim operatingsystem As String
- Dim make As String
- Dim computertype As String
- Set db = CurrentDb
- Set qdf = db.QueryDefs("Admin_query")
- If (Me.CboOS.Value = "All") Then
- operatingsystem = " Like '*' "
- Else
- operatingsystem = "='" & Me.CboOS.Value & "' "
- End If
- If (Me.CboMake.Value = "All") Then
- make = " Like '*' "
- Else
- make = "='" & Me.CboMake.Value = "='" & "' "
- End If
- 'below is only two of the many SQL variations ive tried
- ' strSQL = "SELECT laptops.* " & _
- ' "FROM laptops " & _
- ' "WHERE laptops.operating_sysytem" & operatingsystem & _
- '"AND laptops.manufacturer" & make ;"
- ' strSQL = "SELECT laptops.* " & _
- ' "FROM laptops " & _
- ' "WHERE laptops.[operating_sysytem] = '" & operatingsystem & "' "& _
- ' "AND laptops.[manufacturer]= '" & make & "' " ;"
- qdf.SQL = strSQL
- DoCmd.OpenQuery "Admin_query"
- DoCmd.Close acForm, Me.Name
- ' MsgBox strSQL
- Set qdf = Nothing
- Set db = Nothing
- DoCmd.OpenForm "laptop_specs", , "Admin_query
- End Sub
Regards Panteraboy