forms pop up form

  • Thread starter Thread starter patrick
  • Start date Start date
P

patrick

If the contents of a field is blank (but the record
exists), I wish to ensure that a sub form set to pop up
is not opened when i change the contents from blank to
some character(s).

However if the original contents are not blank i wish to
have the popup open if the entry is altered(changed),
how???

If the control that is being changed is a bound control,
i have been told i can use controls OldValue property to
see if the control was previously blank, if not, then pop-
up theform. This could be done in the BeforeUpdate or
AfterUpdate event of the control. The BeforeUpdate event
will gives methe option to Cancel the update, if idesire.


The problem is my experienece in the progamming side is
weak at best and am not sure quite how to program this,
can someone please give me a little bit of guidance on
how to actually program this with the before update
property
 
Pat, you should reply to the previous message to try to keep the thread
together in one spot. It makes it easier for everyone to follow.

Sample Code:
If Nz(Me.txtMyTextbox.OldValue, "") <> "" And Me.txtMyTextbox.OldValue <>
Me.txtMyTextbox.Value Then
DoCmd.OpenForm "frmMyPopup",,,,,acDialog
End If

The "And" part of the check could probably be skipped. Since the
Before/After Update event is firing, the control was changed. The only thing
this would check for was if the user retyped what was already there. Use the
parameters you need in the OpenForm call. Which ones you need will depend on
what you're wanting your popup form to do.

The Nz function will change a Null value to the indicated value, in this
case a zero length string (""). I did this because I don't know if you are
using zero length strings in your table. Null would be more common, but this
will handle either.

To get to the event procedure, open the Properties sheet for the control and
go to the Events tab. Set the box next to the Before Update or After Update
event to [Event Procedure]. Next, click the ... button and it will take you
to the code editor with the first and last line of the procedure entered for
you.
 
Back
Top