coding help

  • Thread starter Thread starter Lauren B
  • Start date Start date
L

Lauren B

I'm attempting to have a value transfer between two forms when Form A opens
Form B with the following code:

On-click event procedure for command button on Form A:
DoCmd.OpenForm "FormA", , , , acFormAdd, acDialog, [FieldA]

On load event procedure for Form B:
If Me.OpenArgs <> "" Then
Me.FieldA = Me.OpenArgs
End If

I'm getting run-time error '2498': An expression you entered is the wrong
data type for one of the arguments. What can I do to remedy this problem?

Thank you in advance for any assistance.

LB
 
Lauren said:
I'm attempting to have a value transfer between two forms when Form A
opens Form B with the following code:

On-click event procedure for command button on Form A:
DoCmd.OpenForm "FormA", , , , acFormAdd, acDialog, [FieldA]

On load event procedure for Form B:
If Me.OpenArgs <> "" Then
Me.FieldA = Me.OpenArgs
End If

I'm getting run-time error '2498': An expression you entered is the
wrong data type for one of the arguments. What can I do to remedy
this problem?

Thank you in advance for any assistance.

LB

What field type is FieldA? OpenArgs is going to be a string and Access will
usually coerce that to a different data type without incident, but in some
cases you have to explicitly wrap the string in a conversion function.
 
Field A is an autonumber


Rick Brandt said:
Lauren said:
I'm attempting to have a value transfer between two forms when Form A
opens Form B with the following code:

On-click event procedure for command button on Form A:
DoCmd.OpenForm "FormA", , , , acFormAdd, acDialog, [FieldA]

On load event procedure for Form B:
If Me.OpenArgs <> "" Then
Me.FieldA = Me.OpenArgs
End If

I'm getting run-time error '2498': An expression you entered is the
wrong data type for one of the arguments. What can I do to remedy
this problem?

Thank you in advance for any assistance.

LB

What field type is FieldA? OpenArgs is going to be a string and Access
will
usually coerce that to a different data type without incident, but in some
cases you have to explicitly wrap the string in a conversion function.
 
Back
Top