Go Premium for a chance to win a PS4. Enter to Win

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

MS Access 2007 - Want Variable to display in Message Box

I have some simple code In which I want a variable to display in a message box.

Even though I copied some sample code it still does not work.

Here is the code:

Dim LValue As String

LValue =  Now

MsgBox  "The current Time is: " & LValue & " Have a Good Day"

Note: This uses a Now function to put a time value into the variable. Also, I have tried to put regular string text into the variable and that doesn┬┐t display either.

Thanks for any help.
0
jonsuns7
Asked:
jonsuns7
  • 3
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Try this:

Dim LValue As Date

LValue =  Now

MsgBox  "The current Time is: " & LValue & " Have a Good Day"
0
 
jonsuns7Author Commented:
Nope still no luck. Something seems to be preventing the variables from showing up. No matter what variables I try, string, integer
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
In the VBA editor ... Menu >> Debug >> Compile .... are there any errors ?

mx
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Something else is going on ... works for me - see image.

mx
Capture1.gif
0
 
Jeffrey CoachmanCommented:
<No points wanted>
I'm with MX...

Dim LValue As Date
LValue =  Now
MsgBox  "The current Time is: " & LValue & " Have a Good Day"

...works fine for me


Perhaps you should state exactly what "Does" appear when you run the code...

Is this an issue in all forms?, for all users?, in all databases?
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

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