So I have a one table as a backend. All my forms, reports and queries are in a front end. I'm creating multiple forms for users to input data of food items. Once a record is created a user can find it using different forms. In one of the forms the user can find the item by UPC. So far I've created this code On_Click as a Find that opens another form with the found information and closes the search one. Each record has a series of fields (8). On the find by UPC form the user must enter a UPC AND the Quarter for which the product was originally set. If information is missing from either field the a msgbox appears requiring the missing fields. If all fields are completed then the user clicks find and a new form opens up with the information of that product. If the UPC does not match the Quarter or if the UPC doesnt exist I would like a msgbox to say "Records dont exist". I know very little about Access but I'm battling through. Right now I'm having a type missmatch error and on the code Quarter is Highlighted. Current records in quarter are as such Q1-2014, Q2-2014... Any recommendations will be great on anything that can help me get this done.
Code:Private Sub Command25_Click() Dim dbs As Database Dim rst As Recordset Set dbs = OpenDatabase("Databaselabmine.mdb") Set rst = dbs.OpenRecordset("SELECT [Universal Product Code] " _ & "[Quarter] FROM Table1;") If IsNull(Me![Universal Product Code]) Or IsNull(Me![Quarter]) Then MsgBox "Please fill all fields.", vbOKCancel, "Yep" ElseIf Me![Universal Product Code] And Me![Quarter] <> rst Then MsgBox "No records available.", vbOKCancel, "Yep" Else DoCmd.OpenForm "M_M_ELSUPC", acNormal, "", "", , acNormal DoCmd.Close acForm, "EDITupc" DoCmd.SetWarnings False 'ADDED DoCmd.OpenQuery "Table1 Query", acViewNormal, acEdit 'ADDED End If End Sub