Solved

MS Access 2007 - Want Variable to display in Message Box

Posted on 2011-09-08
5
445 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 - Access MVP) 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now