need help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form
When I open it if TA Number is null, the I want a message box to appear, no
travels to approve. And then an okay to click on to close the form.

Can someone please help me with this?
 
Try in the Form_Open Event

Sub Form_Open(Cancel As Integer)
Dim Rs As DAO.Recordset
Set Rs = Me.RecordsetClone
Cancel = Rs.BOF And Rs.EOF
Set Rs = Nothing
If Cancel Then
MsgBox "Go home, everything is done <g>", vbCritical, "We're out of
business"
End If
Exit Sub

HTH

Pieter
 
Try in the Form_Open Event

Sub Form_Open(Cancel As Integer)
Dim Rs As DAO.Recordset
Set Rs = Me.RecordsetClone
Cancel = Rs.BOF And Rs.EOF
Set Rs = Nothing
If Cancel Then
MsgBox "Go home, everything is done <g>", vbCritical, "We're out of
business"
End If
Exit Sub

HTH

Pieter

Chey said:
I have a form
When I open it if TA Number is null, the I want a message box to appear,
no
travels to approve. And then an okay to click on to close the form.

Can someone please help me with this?



--
 
Chey,
Assuming [TA] is on the Main form... use the Main form Current event...

Private Sub Form_Current()
Dim Response as Variant, Prompt as String
Prompt = "No Travels to Approve"
If IsNull([TA]) Then
Response = MsgBox Prompt, vbOKonly
DoCmd.Close
End If
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
There are 10 types of people in the world.
Those who understand binary, and those who don't.
 
Back
Top