Displaying variable value in text box

B

Bongard

Hi, I have a crosscheck in a form that when the wrong amount is entered
it cancels the update and displays a message box informing the user
that the amount they posted will bring the loan balance below zero.
However, I would like to take that loan balance amount and also display
it in the msgbox so that the user knows what the current balance is. I
am retrieving the loan balance with a dlookup to a crosstab query. Here
is my current code:

var1 = DLookup("[balance]", "qry_Transactions_Crosstab", "[Loan Number]
= " & Forms![frm_Transactions]![Loan Number])
If var1 + Forms![frm_Transactions]![Amount] < 0 Then


MsgBox "The outbound transaction must not bring the loan balance below
0 it is currently at var1"


and of course the msgbox just reads var1, but does not display the
value that var1 just looked up in the above line of code.

Any ideas would be appreciated thanks for your help!

-Brian
 
F

fredg

Hi, I have a crosscheck in a form that when the wrong amount is entered
it cancels the update and displays a message box informing the user
that the amount they posted will bring the loan balance below zero.
However, I would like to take that loan balance amount and also display
it in the msgbox so that the user knows what the current balance is. I
am retrieving the loan balance with a dlookup to a crosstab query. Here
is my current code:

var1 = DLookup("[balance]", "qry_Transactions_Crosstab", "[Loan Number]
= " & Forms![frm_Transactions]![Loan Number])
If var1 + Forms![frm_Transactions]![Amount] < 0 Then

MsgBox "The outbound transaction must not bring the loan balance below
0 it is currently at var1"

and of course the msgbox just reads var1, but does not display the
value that var1 just looked up in the above line of code.

Any ideas would be appreciated thanks for your help!

-Brian

You need to concatenate the var1 data into the string, otherwise
Access thinks var1 is a literal part of the string.

MsgBox "The outbound transaction must not bring the loan balance
below 0 it is currently at " & var1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top