Solved

MS Access 2007 - Want Variable to display in Message Box

Posted on 2011-09-08
5
434 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

18 Experts available now in Live!

Get 1:1 Help Now