if statement problem

mech55

Registered User.
Local time
Yesterday, 21:06
Joined
Aug 26, 2005
Messages
61
Basically the problem is this: I have a form which calls for a person to type in a serial number and press a command button which opens up another form based upon that serial number. However I need to put a condition on that. I need that form to open up only if the status of that initial status of that serial number (which is another field is 'pass'). I suppose i'm not sure how to look at that other field based on the serial number that is typed in?

thanks,
 
You could use a Dlookup(). Search the Access help files for more info on the Dlookup() function.
 
open a recordset using the following sql code (adapted to your tables/fields etc)
Code:
Dim rs as DAO.RecordSet
rs.OpenRecordSet("SELECT Status FROM table WHERE [Serial Number] = " & txtSerialNumber)

Then use the if statement here

If rs.Fields("Status") = "pass" Then
   <Open Form>
End If

Hope that helps
 
I'm getting an error using this code

Object variable or With block variable not set (Error 91)

this is my code

Dim rs As DAO.Recordset
rs.OpenRecordset ("SELECT Initial_QC_Status FROM Serial_Number_Log WHERE [Serial_Number] = " & txtSerial#)

'Then use the if statement here

If rs.Fields("Initial_QC_Status") = "pass" Then
DoCmd.OpenForm "Radio Test Data Entry"
End If
 

Users who are viewing this thread

Back
Top Bottom