If Statements

L

Les

Hi, is there a limit to the number of if statements one can do with VBA using
"and" or "or", e.g.

if wwwwww = "" and id xxxxxx = "" and if yyyyyy ="" and if zzzzz = "" then
 
R

Rick Rothstein \(MVP - VB\)

I'm using the compiled VB help files for my reference; but, since it uses
VBA at its core, I am assuming the same limitations apply.

I have never seen a limit on the number of AND or OR parts in a logical
expression, but I would note that a single line of code can consist of up to
1023 total bytes maximum, so that would place a limit on you I guess. Also,
in case you are using line continuations to make your code more readable,
there can be no more than twenty-four line-continuation characters ( _)
included in a single logical line.

Rick
 
L

Les

Thanks Rick, i have to check the following text boxes and combo boxes to make
sure they all have a value in, what would you suggest is the best way to do
this ??

Me.txt_PrtNumber.Value = ""
Me.txt_PrtDescription.Value = ""
Me.txt_PrtQtyPerCar.Value = ""
Me.txt_PercBuildRate.Value = ""
Me.Txt_SuppName.Value = ""
Me.txt_SuppNum.Value = ""
Me.txt_City.Value = ""
Me.Txt_PostCode.Value = ""
Me.cmb_QuartYear.Value = ""
Me.cmb_PrtFam.Value = ""
Me.cmb_AddID.Value = ""
Me.cmb_CntryCode.Value = ""
Me.cmb_Model.Value = ""
Me.cmb_Req = ""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top