Default to current date

G

Guest

Hello,

I have an "Account Receivable" form that is filtered based on the customer's
unique ID. I've added a "SetValue" statement in the macro to add the current
date on the "Payment Received" field when I open the "Account Receivable"
form. This works fine on the first record that pulls up. The problem with
this is that it deletes the existing date value and puts in the current date.
The other problem I'm trying to resolve is to prefill the current date on
multiple records if the field is blank AND when I'm actually adding a $ amt
on the "Check Amt" field. For example: I received one check to pay for
multiple orders. Instead of having to re-enter the same date for multiple
records/orders, I'd like Access to automatically add the current date on
orders that I'm adding payments to.

So to summarize:
1. Automatically add current date value if the field is null AND when
adding a value on the payment field.
2. Prevent the date field from being overridden if it's not null.

Thank you so much for any info/suggestions you can offer.

Thanks again,
Nyla
 
G

Guest

Macros are very limited in their capability. I suggest you use VBA (learn it
if you have to. One learning tool coming from Macros is to convert your
macros to code and study the result)
Okay, preaching over, here is what you need:
Question 1:
In the After Update event of the control where you put payment:
If IsNull(Me.YourDateControlName) Then
Me.YourDateControlName = Date
Me.YourDateControlName.Locked = True
End If

That will put the current date in the payment date control when a payment is
entered and the payment date control is empty. It will also prevent it from
being changed

Question 2:
In the Current Event of your form:
Me.YOurDateControlNameHere.Locked = Not IsNull(Me.YOurDateControlNameHere)

This will lock the control if there is a value in it and unlocke it of there
is not.
 
G

Guest

This sounds like it will do the trick. I will e-mail again with the result.
I totally agree with you -- I do need and want to learn VBA. Thanks for all
your help and your preaching is well deserved. :)

Thanks again,
Nyla
 
G

Guest

Looking forward to knowing how it works out. If you need help getting it to
work, post back.
 
G

Guest

As promised, I wanted to let you know that your suggestion worked! Thank you
so much for your help.

Nyla
 
G

Guest

You are welcome, glad it worked for you

Nyla K said:
As promised, I wanted to let you know that your suggestion worked! Thank you
so much for your help.

Nyla
 

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