Hi all ,,I'm trying to check a table which has a Boolean field before a form is opened, the idea being if the Boolean is true then the form will not open. I already had a check in place which tested if the id number ([text4]) was in the database before the form was opened see below
but I've been trying add a Boolean test that checks if the record has been removed ie the registered field is ticked. The code I'm using always comes up false, i had a look at allen browne page and the format looked to be
No delimiters. Same as numbers, e.g.:
DLookup("FieldName" , "TableName" , "Criteria = False")
but when i try
i always get a false? can anyone please see what my error is , thanks in advance
Code:
If Len(Me.MyTextboxName.Value & vbNullString) > 0 Then
Dim RPSno As Long 'the primary key of the table
RPSno = Nz(DLookup("[text4]", "tblRma", "[text4]= " & Me.MyTextboxName.Value), 0)
'MsgBox RPSno
If (RPSno <> 0) Then
Cancel = True
DoCmd.OpenForm "frmRmaRemove", , , "[text4] = " & Me.MyTextboxName.Value
Else
MsgBox ("Number Does NOT exist in the Database")
Me.MyTextboxName.Value = ""
End If
End If
No delimiters. Same as numbers, e.g.:
DLookup("FieldName" , "TableName" , "Criteria = False")
but when i try
Code:
Dim boolno As Boolean
boolno = Nz(DLookup("[text4]", "tblRma", "registered = false"))