Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

I Need VBA Assistance on record auto update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brent E - 08 Mar 2005 17:39 GMT
Good morning,

I am making an Access VBA module and need assistance. I made a table to
contain a single record and I need to know if there is a way first to assisgn
this record to get its value from a text box on a form entered by a userAnd
then to use VBA to make this record automatically update its value anytime a
user types another value in this text box and clicks on UPDATE button? My
table name is CURRENT_YEAR and my form name is CURR_YEAR.Any suggestions?
Thanks.
Marshall Barton - 09 Mar 2005 15:13 GMT
>I am making an Access VBA module and need assistance. I made a table to
>contain a single record and I need to know if there is a way first to assisgn
>this record to get its value from a text box on a form entered by a userAnd
>then to use VBA to make this record automatically update its value anytime a
>user types another value in this text box and clicks on UPDATE button? My
>table name is CURRENT_YEAR and my form name is CURR_YEAR.Any suggestions?

What is the purpose of the form?

If it's just to let the user specify the CurrYear then bind
the form to the table (with AllowAdditions set to No).

If the form has some other purpose and you want to track the
last value for CurrYear, then use the form's Load event to
retreive the value from the table and put it in the text
box:
    Me.thetextbox = DLookup("CurrYear", "CURRENT_YEAR")

The code behind your update command button would have to
save the value in the text box back to the table:
    CurrentDb.Execute "UPDATE CURRENT_YEAR " _
                & "Set CurrYear = " & Me.thetextbox
   
Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.