< = open form

F

fishqqq

Can someone show me how to do the following:

if the value in field1 is less then the value in field2 the open form1,
close form1, open form1, close form1 etc.

what i'm trying to do is have a credit limit set for a customer
(field1) and if the credit limit is exceeded (field2) then a form will
open/close/open/close (form1) with a flashing message that the customer
has exceeded their credit limit.

I would like this to be triggered whenever form2 is opened

I'm not sure how to begin approaching this one!

any suggestions are greatly appreciated.
Steve
 
F

fredg

Can someone show me how to do the following:

if the value in field1 is less then the value in field2 the open form1,
close form1, open form1, close form1 etc.

what i'm trying to do is have a credit limit set for a customer
(field1) and if the credit limit is exceeded (field2) then a form will
open/close/open/close (form1) with a flashing message that the customer
has exceeded their credit limit.

I would like this to be triggered whenever form2 is opened

I'm not sure how to begin approaching this one!

any suggestions are greatly appreciated.
Steve

Steve,
In my opinion, this is a terrible idea.
You may lose data, and the distraction to the user will be enormous.
This is even worse that having a flashing control on the form.
If I were the user, this would happen twice and I would walk away from
the database.

Be that as it may, code the [Field1] AfterUpdate event:

If [Field1] < [Field2] Then
DoCmd.Close acForm, "YourFormName"
DoCmd.OpenForm "YourFormName"
DoCmd.Close acForm, "YourFormName"
DoCmd.OpenForm "YourFormName"
End If

Far better to just add a Label to the form next to the control.
Set it's caption to something like:
"Over the Credit Limit."
Set it's back color to one that will stand out against the form
background.
Set it's Visible property to No.
Name the Label "lblOverCredit"

Then code the [Field1] AfterUpdate event:
Me![lblOverCredit].Visible = Me![Field1] < Me![Field2]

Place the same code in the form's Current event.
 

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

Top