Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to customize a pop-up

Status
Not open for further replies.

vangx222

Technical User
Jun 6, 2007
36
US
Hi. I have a form that has a date field and some other data entry fields. I have all the OTHER fields disabled and have ONLY the date field enabled. Once you enter data into the date field then automatically all the other fields become Enabled.

I want to create a popup message that appears if the person entering data tries to click on the disabled field, BUT I ONLY want it to popup if there's no data in the date field.

I tried the macro for On Click and it appears everytime I click the form, which I know WILL happen. Is there a code for this?

Thanks.
 
you'd have to put the code into the onClick event of every single control you've disabled...

The disabled controls should be obvious that they can't enter records there, however if you want it more obvious, then as a shortcut, you could make the other controls invisible, instead of disabled...

--------------------
Procrastinate Now!
 
Tagging off of Crowley's post, here is an example in VBA.

I'll assume the control on your form that holds the date value is named txtMyDate and your form has two controls which need to be hidden, named Control1 and Control2. This is a very basic and rough example - modify and expand as desired.

Code:
Private Sub Form_Current()
   If IsNull(Me.txtMyDate.Value) Then
      Me.Control1.Visible = False
      Me.Control2.Visible = False
      'etc.
   Else
      Me.Control1.Visible = True
      Me.Control2.Visible = True
      'etc.
   End If

End Sub

Private Sub txtMyDate_Change()
   If Me.txtMyDate.Value = "" Then
      Me.Control1.Visible = False
      Me.Control2.Visible = False
      'etc.
   Else
      Me.Control1.Visible = True
      Me.Control2.Visible = True
      'etc.
   End If
End Sub

Private Sub Form_Load()
   If IsNull(Me.txtMyDate.Value) Then
      Me.Control1.Visible = False
      Me.Control2.Visible = False
      'etc.
   Else
      Me.Control1.Visible = True
      Me.Control2.Visible = True
      'etc.
   End If
End Sub



~Melagan
______
"It's never too late to become what you might have been.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top