Solved

An update macro for Microsoft Access

Posted on 2016-09-17
12
32 Views
Last Modified: 2016-11-02
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
Comment
Question by:Arthit84
12 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 41803094
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
 

Author Comment

by:Arthit84
ID: 41803098
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
 
LVL 19

Assisted Solution

by:Eric Sherman
Eric Sherman earned 250 total points (awarded by participants)
ID: 41803131
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
 
LVL 19

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 250 total points (awarded by participants)
ID: 41803134
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
 

Author Comment

by:Arthit84
ID: 41803145
thanks experts i will test this later tonite.
0
 
LVL 19
ID: 41803147
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Arthit84
ID: 41803152
any of the experts that have worked with access Web app in sharepoint?
0
 
LVL 19

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 250 total points (awarded by participants)
ID: 41803154
0
 

Author Comment

by:Arthit84
ID: 41803940
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
 
LVL 19
ID: 41804014
you're welcome ~ glad you like it
0
 
LVL 19
ID: 41833337
poster said he would come back but didn't ... guess he is busy working on his app!
0
 

Author Comment

by:Arthit84
ID: 41871092
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now