Open Arguments Problem - Please Help...

G

Guest

I created this OnClick code for a command button to pass an argument to the
form I'm opening. The problem is that for some reason when the form open
procedure on the other form runs the field Me.RawInputID shows that it is a
Null value. I placed a breakpoint before the End If statement of this code
and looked at the value of the field Me.RawInputID and it shows up with the
correct value. But on the opening form, when I set my variable equal to the
open arguments the value of open arguments is shown as null.

I'm not sure what I'm doing wrong here and I hope that I was clear, but if
you need any further information please let me know.

Command Button Code:
Dim Message As String
Dim Buttons As String
Dim stDocName As String
Dim stLinkCriteria As String

Message = "Enter Raw Product Information first."
Buttons = vbOKOnly
stDocName = "ProductOutputEntryForm"
stLinkCriteria = "[RawInputID] =" & Me.RawInputID

If IsNull(Me.RawInputID) Then
Cancel = MsgBox(Message, Buttons, "Missing Information") = vbCancel
Else
DoCmd.OpenForm stDocName, , , , , , Me.RawInputID
End If

Form Open Code:

Dim intRawInputID As Integer
Dim rst As DAO.Recordset
Dim stLinkCriteria As String

intRawInputID = Me.OpenArgs

Thanks for any help...
 
F

fredg

I created this OnClick code for a command button to pass an argument to the
form I'm opening. The problem is that for some reason when the form open
procedure on the other form runs the field Me.RawInputID shows that it is a
Null value. I placed a breakpoint before the End If statement of this code
and looked at the value of the field Me.RawInputID and it shows up with the
correct value. But on the opening form, when I set my variable equal to the
open arguments the value of open arguments is shown as null.

I'm not sure what I'm doing wrong here and I hope that I was clear, but if
you need any further information please let me know.

Command Button Code:
Dim Message As String
Dim Buttons As String
Dim stDocName As String
Dim stLinkCriteria As String

Message = "Enter Raw Product Information first."
Buttons = vbOKOnly
stDocName = "ProductOutputEntryForm"
stLinkCriteria = "[RawInputID] =" & Me.RawInputID

If IsNull(Me.RawInputID) Then
Cancel = MsgBox(Message, Buttons, "Missing Information") = vbCancel
Else
DoCmd.OpenForm stDocName, , , , , , Me.RawInputID
End If

Form Open Code:

Dim intRawInputID As Integer
Dim rst As DAO.Recordset
Dim stLinkCriteria As String

intRawInputID = Me.OpenArgs

Thanks for any help...

The form's Open event is too early.
Use the Form's Load event to check for OpenArgs.
 
G

Guest

I tried moving the code to the Load event, but I still get the same problem.
--
Kellie Murphy


fredg said:
I created this OnClick code for a command button to pass an argument to the
form I'm opening. The problem is that for some reason when the form open
procedure on the other form runs the field Me.RawInputID shows that it is a
Null value. I placed a breakpoint before the End If statement of this code
and looked at the value of the field Me.RawInputID and it shows up with the
correct value. But on the opening form, when I set my variable equal to the
open arguments the value of open arguments is shown as null.

I'm not sure what I'm doing wrong here and I hope that I was clear, but if
you need any further information please let me know.

Command Button Code:
Dim Message As String
Dim Buttons As String
Dim stDocName As String
Dim stLinkCriteria As String

Message = "Enter Raw Product Information first."
Buttons = vbOKOnly
stDocName = "ProductOutputEntryForm"
stLinkCriteria = "[RawInputID] =" & Me.RawInputID

If IsNull(Me.RawInputID) Then
Cancel = MsgBox(Message, Buttons, "Missing Information") = vbCancel
Else
DoCmd.OpenForm stDocName, , , , , , Me.RawInputID
End If

Form Open Code:

Dim intRawInputID As Integer
Dim rst As DAO.Recordset
Dim stLinkCriteria As String

intRawInputID = Me.OpenArgs

Thanks for any help...

The form's Open event is too early.
Use the Form's Load event to check for OpenArgs.
 
G

Guest

Thanks for your help. I did figured out what the problem was after I moved
the code the form Load section.
--
Kellie Murphy


Kmurphy said:
I tried moving the code to the Load event, but I still get the same problem.
--
Kellie Murphy


fredg said:
I created this OnClick code for a command button to pass an argument to the
form I'm opening. The problem is that for some reason when the form open
procedure on the other form runs the field Me.RawInputID shows that it is a
Null value. I placed a breakpoint before the End If statement of this code
and looked at the value of the field Me.RawInputID and it shows up with the
correct value. But on the opening form, when I set my variable equal to the
open arguments the value of open arguments is shown as null.

I'm not sure what I'm doing wrong here and I hope that I was clear, but if
you need any further information please let me know.

Command Button Code:
Dim Message As String
Dim Buttons As String
Dim stDocName As String
Dim stLinkCriteria As String

Message = "Enter Raw Product Information first."
Buttons = vbOKOnly
stDocName = "ProductOutputEntryForm"
stLinkCriteria = "[RawInputID] =" & Me.RawInputID

If IsNull(Me.RawInputID) Then
Cancel = MsgBox(Message, Buttons, "Missing Information") = vbCancel
Else
DoCmd.OpenForm stDocName, , , , , , Me.RawInputID
End If

Form Open Code:

Dim intRawInputID As Integer
Dim rst As DAO.Recordset
Dim stLinkCriteria As String

intRawInputID = Me.OpenArgs

Thanks for any help...

The form's Open event is too early.
Use the Form's Load event to check for OpenArgs.
 

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