UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> probelm with if statement - please advise    
 
   
swaziman2
post Nov 4 2008, 04:45 PM
Post #1

UtterAccess Enthusiast
Posts: 85



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
Go to the top of the page
 
+
R. Hicks
post Nov 4 2008, 04:49 PM
Post #2

UA Forum Administrator
Posts: 38,073
From: Birmingham, Alabama USA



Are these controls on the current form ???

If Yes .. then try:

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

RDH
Go to the top of the page
 
+
swaziman2
post Nov 4 2008, 04:55 PM
Post #3

UtterAccess Enthusiast
Posts: 85



no , txtproductstatus is on my main form , the code is on my subform on_current event
Go to the top of the page
 
+
rsindle
post Nov 4 2008, 04:55 PM
Post #4

UtterAccess VIP
Posts: 1,402
From: Northern Virginia



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
Go to the top of the page
 
+
R. Hicks
post Nov 4 2008, 04:59 PM
Post #5

UA Forum Administrator
Posts: 38,073
From: Birmingham, Alabama USA



If the control is on the main form .. then try:

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

RDH
Go to the top of the page
 
+
swaziman2
post Nov 4 2008, 05:15 PM
Post #6

UtterAccess Enthusiast
Posts: 85



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
Go to the top of the page
 
+
R. Hicks
post Nov 4 2008, 05:20 PM
Post #7

UA Forum Administrator
Posts: 38,073
From: Birmingham, Alabama USA



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

RDH
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 03:09 AM