Solved

MS Access 2007 - Want Variable to display in Message Box

Posted on 2011-09-08
5
486 Views
Last Modified: 2012-06-21
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
Comment
Question by:jonsuns7
  • 3
5 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 36506903
Try this:

Dim LValue As Date

LValue =  Now

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

Author Comment

by:jonsuns7
ID: 36506941
Nope still no luck. Something seems to be preventing the variables from showing up. No matter what variables I try, string, integer
0
 
LVL 75
ID: 36506968
In the VBA editor ... Menu >> Debug >> Compile .... are there any errors ?

mx
0
 
LVL 75
ID: 36507371
Something else is going on ... works for me - see image.

mx
Capture1.gif
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36507433
<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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Updating a field based from a if exist.... 2 31
Database maintenance 36 98
MS Access Query Question 2 33
SP inserts data with order number, then push the rest one order up 11 15
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question