An update macro for Microsoft Access

Hi, Experts

I have been trying to create a macro to update a colum for sometime now but i wont work :(

Here is what i want to do.

i have a field call Deliverystatus with two choice "Not delivered" and "delivered"
I have another field call Delivered date

I want to create a macro so that when someone change Deliverytstatus to "delivered"
The Delivered Date gets populate but the todays date.

Please some point me into right direction :D

Thanks in advance
Arthit84Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Ryan ChongCommented:
Access is limited and do not have the trigger feature built-in, hence we can't execute a DML command by detecting update of a field.

>>I want to create a macro so that when someone change Deliverytstatus to "delivered"
The Delivered Date gets populate but the todays date.
we need to know how the end user update the DeliveryStatus? if it's via a Form, we need to execute an update sql statement after the change is completed.
0
 
Arthit84Author Commented:
Thansk for answering Ryan

yes it is via Form

i am not an expert in access so please tell me a little about the update SQL statement
0
 
Eric ShermanAccountant/DeveloperCommented:
Use the AfterUpdate of your control on the Form as shown below ...

Private Sub ComboDeliveryStatus_AfterUpdate()

If Me.ComboDeliveryStatus = "Delivered"  Then
     Me.Delivery_Date = Now()
Else
     Me.Delivery_Date = Null
End If

Me.Dirty = False

End Sub


ET
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
actually Access does have "triggers". They are called Data Macros. It is easier, however, to use VBA and respond to a form or control event.
0
 
Arthit84Author Commented:
thanks experts i will test this later tonite.
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you're welcome :)

Now() gives you date and time.  If you only want date, use
Date()

Open in new window

... and change the reference to Me.Delivered_Date (says Me.Delivery_Date)
0
 
Arthit84Author Commented:
any of the experts that have worked with access Web app in sharepoint?
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Arthit84Author Commented:
Thanks for the links i watched the video its really great and fun to know that Access is very powerful.
I have not have the time to test it, i will test and report back.
Best regards
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you're welcome ~ glad you like it
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
poster said he would come back but didn't ... guess he is busy working on his app!
0
 
Arthit84Author Commented:
Hello i apologize that i have not been online, i though that i already close this thread at sepetember i quess i must have done something wrong.
The app is working great and i am really learn alot from the website from the video.
Now i am taking some course in Lynda and CBTnuggets on Access :D

Thanks you again and sorry that i missed this thread
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.