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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If then else statement

Status
Not open for further replies.

5556

Programmer
May 27, 2003
17
US
I need an IF then else statement so if the origin value = 0 the record is not added to the table. This is the code I have.

SourceSet.AddNew
SourceSet!Employee_Name = Text137.Value
SourceSet!Stop1 = Combo0.Value
SourceSet!Origin = Combo8.Value
SourceSet!Stop2 = Combo2.Value
SourceSet!Stop3 = Combo4.Value
SourceSet!Stop4 = Combo6.Value
SourceSet!Stop1_dist = Text10.Value
SourceSet!Stop2_dist = Text13.Value
SourceSet!Stop3_dist = Text14.Value
SourceSet!Stop4_dist = Text15.Value
SourceSet!Datefield = ActiveXCtl22.Value
SourceSet.Update
SourceSet.AddNew
SourceSet!Employee_Name = Text137.Value
SourceSet!Datefield = ActiveXCtl65.Value
SourceSet!Origin = Combo54.Value
SourceSet!Stop1 = Combo46.Value
SourceSet!Stop2 = Combo48.Value
SourceSet!Stop3 = Combo50.Value
SourceSet!Stop4 = Combo52.Value
SourceSet!Stop1_dist = Text56.Value
SourceSet!Stop2_dist = Text58.Value
SourceSet!Stop3_dist = Text59.Value
SourceSet!Stop4_dist = Text60.Value
SourceSet.Update
 
This should work for you.

If Combo8 <> 0 then
SourceSet.AddNew
SourceSet!Employee_Name = Text137.Value
SourceSet!Stop1 = Combo0.Value
SourceSet!Origin = Combo8.Value
SourceSet!Stop2 = Combo2.Value
SourceSet!Stop3 = Combo4.Value
SourceSet!Stop4 = Combo6.Value
SourceSet!Stop1_dist = Text10.Value
SourceSet!Stop2_dist = Text13.Value
SourceSet!Stop3_dist = Text14.Value
SourceSet!Stop4_dist = Text15.Value
SourceSet!Datefield = ActiveXCtl22.Value
SourceSet.Update
end if

If Combo45 <> 0 then
SourceSet.AddNew
SourceSet!Employee_Name = Text137.Value
SourceSet!Datefield = ActiveXCtl65.Value
SourceSet!Origin = Combo54.Value
SourceSet!Stop1 = Combo46.Value
SourceSet!Stop2 = Combo48.Value
SourceSet!Stop3 = Combo50.Value
SourceSet!Stop4 = Combo52.Value
SourceSet!Stop1_dist = Text56.Value
SourceSet!Stop2_dist = Text58.Value
SourceSet!Stop3_dist = Text59.Value
SourceSet!Stop4_dist = Text60.Value
SourceSet.Update
End If

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top