Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for an If Statement

Status
Not open for further replies.

eieio

Technical User
Oct 25, 2000
5
US
I need to write an If statement for transferring data from unbound text boxes to several (ok - 50) different subforms.

I have NO IDEA how to do this. I think I know what I want to say but don't know how to say it - -

I need a statement that will evaluate each box on THREE merits and then act on the results. I think what I need to say is something like this:

IF "Box1" is NOT null AND IF "Box2"=1 AND IF "Box3"=1, THEN
Copy "Box1" to "Subform1", ELSE
IF "Box10" is NOT null AND IF "Box11"=1 AND IF "Box12"=2, THEN Copy "Box10" to "Subform2", ELSE
and continuing for all 50 unbound boxes.

Please, if anyone can point me in the right direction. I have no experience with code, but willing to learn - the books are just tooooooo confusing, though.

Thanks for any input.

EIEIO
 
Hi EIEIO,

firstly i cant see how or why you would have 50 subforms,

as for the if statement(s)

IF Not isnull(Box1) AND Box2=1 AND Box3=1 THEN

-> Copy "Box1" to "Subform1", ELSE

end if

next if(s) the else statement will exclude all other actions in the if elseif... statement ie after the first if statement that evaluates to true there will be know more processing of the if elseif tree, i don't think you intend that.

as for the copy need to know a little more the general case is

me.subformName.textBoxName = me.Box1

HTH

Robert Dwyer
rdwyer@orion-online.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top