Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Dynamically updating an unbound control from data stored in a table

I have a MS Access 2007 database that is used to refresh off-line tables from an external data source. I have a utility table where I am storing the last updated date. I would like to query that data dynamically when my form opens to update an unbound control.

I don’t have much experience with VBA, but am guessing this would be a pretty easy tasks.

The control name is: txLastUp
The from name is: frmUtility
The SQL to pull the value back via a query is: SELECT utlValue FROM tblUtility WHERE (((utlMod)='frmUtility') AND ((utlCode)='LASTUP'));

Thank you in advance,
Mike
0
mmcrain
Asked:
mmcrain
1 Solution
 
peter57rCommented:
You can store the sql as a saved query and you can then retrieve the value easily.

me.txLastUp= dlookup("utlvalue", "savedqueryname")

It sounds from your description that this code can go in the Form_Load event procedure.

Alternatively, instead of saving the query,  you can just use a qualified dlookup()

me.txLastUp= dlookup("utlvalue", "tblUtility", "utlMod='frmUtility' AND utlCode='LASTUP'")
0
 
mmcrainAuthor Commented:
That worked great. Thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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