Code stopped working

mdjks

Registered User.
Local time
Today, 14:45
Joined
Jan 13, 2005
Messages
96
The code below worked fine yesterday, today the form just opens either way. Any idea what could change overnight?



Private Sub cmdEnterData_Click()

'If Me!Hospital = Null Then 'I tried this too.
If Me.Hospital = "" Then
Beep
MsgBox "Select Hospital Abbreviation", vbOKOnly, "Hospital Abbreviation "

Else
DoCmd.SetWarnings False

DoCmd.OpenQuery "qUpdateIndex"
Dim stlinkcriteria As String
Dim db As Database
Dim fld As Field

stDocName = "fMonthlyHospitalDataEntry"

stlinkcriteria = "[Index]=" & "'" & Me![Index] & "'"
DoCmd.OpenForm stDocName, , , stlinkcriteria
DoCmd.SetWarnings True
End If
Exit Sub

End Sub
 
'If Me!Hospital = Null Then 'I tried this too.
If Me.Hospital = "" Then
s/b
Code:
If IsNull([Hospital]) Or [Hospital] = "" Then
You have other problems in your code but this is the odvious.
 
It was working fine with the me.hospital= "" then statement when I put it in yesterday. I was confused when it ignored the null today.

Thank you, the
IsNull([Hospital]) Or [Hospital] = "" Then
is working correctly.
 

Users who are viewing this thread

Back
Top Bottom