?
Solved

An update macro for Microsoft Access

Posted on 2016-09-17
12
Medium Priority
?
48 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 53

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 1000 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 22

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 1000 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 22
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
 

Author Comment

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

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 1000 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 22
ID: 41804014
you're welcome ~ glad you like it
0
 
LVL 22
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

764 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