Form Conditions

denileigh

Registered User.
Local time
Today, 22:30
Joined
Dec 9, 2003
Messages
212
Hi!

I have a form for billing. I need to make it impossible not to enter the date if there is a billing amount in the billing column.

Basically what I need is some sort of condition that says:

If the billing amount is greater than zero that a date must be entered before doing anything else.

Is there a code for that?

Also, I have a custom menu bar. How do you open forms in add mode from it?

Is there an On Open event I can use?

THANKS1
 
denileigh,

You can use the AfterUpdate event of the Billing
Amount field to do:

Code:
If Nz(Me.BillingAmount, 0) > 0 Then
   MsgBox("You must enter a Billing Date")
   Me.BillingDate.SetFocus
End If

You can also use (maybe better) the form's
BeforeUpdate event to put the same code.

Wayne
 
THANKS! Is there any way to have it only display that if the billing date is actually blank?

For example...if the billing is greater than zero and the billing date is blank?
 
denileigh,

Sure, you can use this in the OnCurrent event of your form:

Code:
If Nz(Me.BillingAmount, 0) = 0 Then
   Me.BillingDate.Visible = False
Else
   Me.BillingDate.Visible = True
End If

Wayne
 
That made all the dates disappear.

Let me explain a little better.

We do partial billings but for us to figure jobs we have to have all the costs in the invoice summary. Therefore, each line item has a date by it.

For example, we may do an inspection, repair and test.

If we are billinb for the inspection only the VP only enters the date and amount on that line, the problem is...he almost always forgets to enter the date so I need it to either stop him or warn him if he tries to enter a billing amount that does not have a date in the date field next to it.

Does that help?

Thanks so much!
 
denileigh,

If the AfterUpdate of the BillingAmount (and the Message Box)
doesn't do it, then we'll have to resort to hard-ball.

You can use the BeforeUpdate event of the form to trigger the
same Message Box and SetFocus property.

If that still does not work, I know an API routine that will shut
down his/her computer and get them/it a tee-time at the
nearest golf course.

OK, I just re-read the post, you can use the AfterUpdate of the
BillingAmount field (and/or) the form's BeforeUpdate event to put
the same code.

Wayne
 

Users who are viewing this thread

Back
Top Bottom