Update a Label In Another Form

J

Jeff Garrison

This sounds easy, but apparently not for me...

I have a for that has a label on it. That label has a value in it
(caption). I would like to be able to update that caption on that form via
VBA. I have a function that updates a value in a backend table. I want to
take that value and update the caption on that form (which will always be
closed). I've tried using the following in the function, but it errors out:
....
DoCmd.OpenForm "frmDatabaseLogon", acNormal
Me.lblVersion.Caption = strVersion
....

The error comes back saying invalid use of the Me keyword.

Any help would be appreciated...

Jeff G
 
K

KARL DEWEY

Seems to me the easier way would be to use a text box with formatting to look
like a label and use macro Set Value.
 
J

Jeff Garrison

I tried using that, but how do I store that value that is placed in that
field, which isn't bound or stored anywhere, but on the form?
 
F

fredg

This sounds easy, but apparently not for me...

I have a for that has a label on it. That label has a value in it
(caption). I would like to be able to update that caption on that form via
VBA. I have a function that updates a value in a backend table. I want to
take that value and update the caption on that form (which will always be
closed). I've tried using the following in the function, but it errors out:
...
DoCmd.OpenForm "frmDatabaseLogon", acNormal
Me.lblVersion.Caption = strVersion
...

The error comes back saying invalid use of the Me keyword.

Any help would be appreciated...

Jeff G

The form on which you wish to change the caption is closed at the
time?

Dim strVersion as String
strVersion = "Something"

DoCmd.OpenForm "frmDatabaseLogon", acDesign, , , , acHidden
Forms!frmDatabaseLogon!lblVersion.Caption = strVersion
DoCmd.Close acForm, "frmDatabaseLogon", acSaveYes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top