Full Version: probelm with if statement - please advise
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
swaziman2
Hi,

I am trying the following but i'm getting a 'complie error: expected expression" at the 'approve' part of the code , can any one suggest why?

if "&[forms]![frmdeal]![txtproductstatus] &"= 'Approve' or "&[forms]![frmdeal]![txtproductstatus] &"= 'Approvable' then

thanks
R. Hicks
Are these controls on the current form ???

If Yes .. then try:

If Me.[txtproductstatus]= "Approve" Or Me.[txtproductstatus] = "Approvable" Then

RDH
swaziman2
no , txtproductstatus is on my main form , the code is on my subform on_current event
rsindle
If they are NOT on the current form, just replace the "Me." from Ricky with [forms]![frmdeal]! and it becomes:

If [forms]![frmdeal]![txtproductstatus]= "Approve" Or [forms]![frmdeal]![txtproductstatus] = "Approvable" Then


Rob
R. Hicks
If the control is on the main form .. then try:

If Me.Parent.[txtproductstatus]= "Approve" Or Me.Parent.[txtproductstatus] = "Approvable" Then

RDH
swaziman2
I think i see my problem , i have single quotation marks around my 'apporve' and 'approvable' where as yours have have double quotations marks , it works now that i've vhanged it , thank you both for all your help.
Incidently I always thought if you were refering to a value in the textbox you were supposed to use single quotes.

thanks
R. Hicks
You only need single quotes to delimit text within a string in code.

RDH
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.