Hello
I am using an If statement to test if a field = IsNull then close that
form and open another one. Here is the code:
Private Sub Form_Load()
If IsNull(Me.loc_fk) Then
MsgBox "This location does not have a compressor, click on New
Compressor to add one"
DoCmd.Close acForm, "compressors-view", acSaveNo
DoCmd.OpenForm "locations", acNormal
End If
End Sub
The code is working fine, but the problem is the "locations" Form is
not opening. I think the problem is because this form (the one that has
the Form_Load) opens when I click on a button from locations Form AND
this button closes the locations form and opens the Form_Load. Maybe
its a contradiction b/w one form trying to close it and the other one
saying to open it??? because I tried doing:
If IsNull(Me.loc_fk) Then
MsgBox "This location does not have a compressor, click on New
Compressor to add one"
DoCmd.Close acForm, "compressors-view", acSaveNo
DoCmd.OpenForm "compressors", acNormal
End If
End Sub
basically just changed the OpenForm from location to compressors and it
did work. The compressors form opened w/o any problem
Can somebody give me an idea of whats happening here??? I've been
trying to figured this out for 3 hours w/o any lucky
Please help
Thanks