No value in openargs

  • Thread starter Thread starter Jonathan Blitz
  • Start date Start date
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."
 
It's a bit hard to tell without seeing your code -
but I generally just use OpenArgs, without the Me. prefix.

HTH
- Turtle
 
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."
 
String concatenation should be done use the & operator....not +. It is very
likely that this is the problem.
 
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."
 
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.
 
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."
 
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"
 
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."
 
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.
 
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."
 
Back
Top