Hi there again folks. Ps thanks for all the help gettin me this far. I get an 3075 syntax error (missing operator) in the following code of the click event. The code worked fine before i added the harddrive criteria. Is there something wrong with this bit of code or should i be taking a different approach. The idea is that if the hardrive is low spec it will return all the records smaller than 120 in the database
regards panteraboy
Code:
"AND laptops.hard_drive >=" & harddrive & _
Code:
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 Dim bluetooth As String Dim harddrive As Integer 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 If (Me.CboComputerType.Value = "All") Then computertype = " Like '*' " Else computertype = "='" & Me.CboComputerType.Value & "' " End If If (Me.CboBluetooth.Value = "All") Then bluetooth = " Like '*' " Else bluetooth = "='" & Me.CboBluetooth.Value & "' " End If If (Me.CboStorage.Value = "Low Spec") Then harddrive = 120 ElseIf (Me.CboStorage.Value = "Normal Spec") Then harddrive = 180 Else harddrive = 300 End If strSQL = "SELECT laptops.* " & _ "FROM laptops " & _ "WHERE laptops.operating_sysytem" & operatingsystem & _ "AND laptops.manufacturer" & make & _ "AND laptops.bluetooth" & bluetooth & _ "AND laptops.ComputerType" & computertype & _ "AND laptops.hard_drive >=" & harddrive & _ "ORDER BY laptops.model;" qdf.SQL = strSQL Dim msg As String msg = "Sorry there are no models in stock with that specification" If IsNull(DLookup("model", "admin_query", "product_id")) Then MsgBox msg Set qdf = Nothing Set db = Nothing Exit Sub Else DoCmd.Close acForm, Me.Name Set qdf = Nothing Set db = Nothing DoCmd.OpenForm "laptop_specs", , "Admin_query" End If End Sub
Comment