If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Displaying variable value in text box
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 |
#2
|
|||
|
|||
Displaying variable value in text box
On 15 Dec 2006 08:59:10 -0800, Bongard wrote:
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 -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
Displaying variable value in text box
fredg's answer is correct. You just has the syntax wrong.
Another thing you could do, if you would like the loan balance on the form so the user could see it at any time would be to use the code you use to populate the var1 variable as the Control Source of a text box on your form, but without the var1 = = DLookup("[balance]", "qry_Transactions_Crosstab", "[Loan Number] = " & Forms![frm_Transactions]![Loan Number]) "Bongard" wrote: 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 |
#4
|
|||
|
|||
Displaying variable value in text box
Thank you very much guys, problem solved!
-brian |
Thread Tools | |
Display Modes | |
|
|