No value in openargs

J

Jonathan Blitz

I am opening a form using docmd.openform and sending it a value in the
openargs paramters.

Although everything looks ok on the openform command the value doesn't reach
the target form. The value there is null.
I am accessing it using Me.OpenArgs.

What is wrong?

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
M

MacDermott

It's a bit hard to tell without seeing your code -
but I generally just use OpenArgs, without the Me. prefix.

HTH
- Turtle
 
J

Jonathan Blitz

This is the "calling" code:

Private Sub Go_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim args As String

stDocName = "frmCommissions"
stLinkCriteria = "MarketID = " + CStr(Me.Market) + " and MonthInternal =
" + CStr(Me.Month) + " and ProductTypeId = " + CStr(Me.ProductType)
args = CStr(Me.Market) + " " + CStr(Me.Month) + " " +
CStr(Me.ProductType)

DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria, , , args

End Sub

This is the code in the target form:


Private Sub Form_Open(Cancel As Integer)
x = openArgs

End Sub

I get null in openargs - even if I use Me.openArgs

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
P

Paul Overway

String concatenation should be done use the & operator....not +. It is very
likely that this is the problem.
 
J

Jonathan Blitz

Worked.
Many thanks.

Why does it allow + if it doean't wotk properly.

Also, why on the "caller" is the value shown ok?

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
P

Paul Overway

It is allowed and there may be cases where you'd want to use it, but in your
case it makes an attempt to coerce the string to a numeric and fails. If
all your strings contained numeric data, it would add the values.
 
J

Jonathan Blitz

Ok.

Many thanks.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
M

Marshall Barton

Jonathan said:
Worked.
Many thanks.

Why does it allow + if it doean't wotk properly.

Also, why on the "caller" is the value shown ok?


The big difference between using + and & to concatenate
strings is that + propogates Null values and & treats Null
values as if they were empty strings. another way of saying
that is:

Null + "abc" reults in Null
while
Null & "abc" results in "abc"
 
J

Jonathan Blitz

The weird thing is that in the "calling" form I can see the value ok in the
string passed as the open args.
Only in the target does the value appear empty.

When I use & all is ok.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
M

Marshall Barton

Jonathan said:
The weird thing is that in the "calling" form I can see the value ok in the
string passed as the open args.
Only in the target does the value appear empty.

When I use & all is ok.

I don't know what's causing that.

I was only trying to explain the major difference between
the two concatenation operators.
 
J

Jonathan Blitz

Thanks anyway.
That's an important thing I need to know.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 

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