How to open a form with multiple Args

A

Ayo

This line of code is suppose to open another form and use these OpenArgs as
values in some of the controls in the new form.

DoCmd.OpenForm "Invoice by Dates", acNormal, acWindowNormal,
OpenArgs:=Me.txtStartDate.Value & "," & Me.txtEndDate.Value & "," &
Me.cmbVendor.Value & "," & Me.cmbReviewer

I am able to get it to work for the first two Args, i.e.
Me.txtStartDate.Value & "," & Me.txtEndDate.Value but I can't get the other
Args to show on the 2nd form. I was using this codes,
commaOne = InStr(Me.OpenArgs, ",")
commaTwo = InStr(Mid(Me.OpenArgs, commaOne + 1), ",")
commaThree = InStr(Mid(Me.OpenArgs, commaTwo + 1), ",")

but I can't figure out what is wrong.

Thanks for your help.
 
V

Viv

Ayo,

I would try inserting the following code in the form :-
msgbox ("$" & Me.OpenArgs & "$")
msgbox ("£" & commaOne & "£$" & commaTwo & "$%" & commaThree & "%")

This will show what OpenArgs reaches the form, and the values of commaOne,
etc. If these are correct then I look at the values of Mid(Me.OpenArgs,
commaOne+1) etc to see if these are correct.

You should also look at the values you get when you extract the four
parameters which you concatenated in order to use OpenArgs as it sounds as if
the last two are not extracted correctly.

It may also be worthwhile rearranging the order of the parameters passed to
the form to see what effect this has.

(I use "£" etc in case there are spaces at the ends of expressions.)

I hope this helps.

Viv
 

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

Top