Displaying a stored value

M

Mike

Hi,
in a form I use the following working expression:
Dim strVersion As String
strVersion = 20080219
.... If DMax("[Version]", "[fileversion]") = strVersion Then
Me.Visible = False...
I'd like to display the strVersion content in a field so I do...
=[strVersion].
Obviously I'm doing some wrong because I get a Name? displayed error.
Where am I failing?
TIA
Mike
 
A

Amy Blankenship

Mike said:
Hi,
in a form I use the following working expression:
Dim strVersion As String
strVersion = 20080219 'you are actually passing a number to this string...

... If DMax("[Version]", "[fileversion]") = strVersion Then
Me.Visible = False...
I'd like to display the strVersion content in a field so I do...
=[strVersion].
Obviously I'm doing some wrong because I get a Name? displayed error.
Where am I failing?

Try

strVersion = "20080219"

Me.ControlName.Value = strVersion

Or

Me.ControlName.DefaultValue=strVersion

Depending on what you're trying to accomplish.

HTH;

Amy
 
B

Beetle

Since strVersion is a code variable (not a stored value), if you want to
assign it to a control on your form, you need to do it in code, not
in the control source. Something like;

Me![YourControlName] = strVersion
 
M

Mike

Thank you, both examples worked. But how do I add a text to strVersion?
I'd like the following to be displayed: Your latest version is: strVersion.
Mike
 
K

Klatuu

Private Function ShowVersion()
ShowVersion = "Your latest version is: " & Nz(DMax("[Version]",
"[fileversion]"), "Unknown")
End Function

Use a function like as above. Then use the function as the control source
of your control like:

=ShowVersion
--
Dave Hargis, Microsoft Access MVP


Mike said:
Thank you, both examples worked. But how do I add a text to strVersion?
I'd like the following to be displayed: Your latest version is: strVersion.
Mike



Mike said:
Hi,
in a form I use the following working expression:
Dim strVersion As String
strVersion = 20080219
... If DMax("[Version]", "[fileversion]") = strVersion Then
Me.Visible = False...
I'd like to display the strVersion content in a field so I do...
=[strVersion].
Obviously I'm doing some wrong because I get a Name? displayed error.
Where am I failing?
TIA
Mike
 
M

Mike

Thank you all. Got it working...

Private Function ShowVersion()
ShowVersion = "Available version is: " & Nz(DMax("[Version]",
"[fileversion]"), "Unknown")
End Function

Private Function ShowFileVersion()
Dim strVersion As String
strVersion = 5556
ShowFileVersion = "Your file version is: " & strVersion
End Function

controls:
=ShowFileVersion()
=ShowVersion()
 
Top