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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Message Box 4
Email in access 4
Add some stuff to code 7
Email in Access 5
Revise code 2
go to 2
copy 18
email in access 2

Back
Top