• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 56
  • Last Modified:

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
0
Arthit84
Asked:
Arthit84
3 Solutions
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
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

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now