runtime error 94

G

Guest

I have a form set up with a drop down list to select the item for a report.
The report is the only thing that opens the form. I changed the data
structure of my database, and now I get a Runtime Error 94: Invalid use of
null error. I can not figure it out. If I remove the event procedure on the
On Open property for the form, the form will open and I can select items from
the drop down list, but when I click on the preview button, the form simply
disappears. If I try to run the report, Access crashes. The On Open Event
Procedure is listed below.

Private Sub Form_Open(Cancel As Integer)
Me.Caption = Forms![Store Report].OpenArgs
End Sub
Private Sub Preview_Click()
If IsNull(Me![Store]) Then
MsgBox "You must select a store from the drop down list."
DoCmd.GoToControl "Store"
Else
Me.Visible = False
End If
End Sub

any help would be greatly appreciated.
 
B

Brian

Christopher Robin said:
I have a form set up with a drop down list to select the item for a report.
The report is the only thing that opens the form. I changed the data
structure of my database, and now I get a Runtime Error 94: Invalid use of
null error. I can not figure it out. If I remove the event procedure on the
On Open property for the form, the form will open and I can select items from
the drop down list, but when I click on the preview button, the form simply
disappears. If I try to run the report, Access crashes. The On Open Event
Procedure is listed below.

Private Sub Form_Open(Cancel As Integer)
Me.Caption = Forms![Store Report].OpenArgs
End Sub
Private Sub Preview_Click()
If IsNull(Me![Store]) Then
MsgBox "You must select a store from the drop down list."
DoCmd.GoToControl "Store"
Else
Me.Visible = False
End If
End Sub

any help would be greatly appreciated.

Re the error 94, the problem is clearly that Forms![Store Report] was opened
without a value being supplied for OpenArgs. The problem needs to be
addressed at the point where that form is opened, wherever that might be.

Presumably the form disappears because Store is not null. In that case, the
statement Me.Visible = False will be executed (to make the form invisible
i.e. disappear), and that's it! There's nothing else there!
 
G

Guest

Brian said:
Christopher Robin said:
I have a form set up with a drop down list to select the item for a report.
The report is the only thing that opens the form. I changed the data
structure of my database, and now I get a Runtime Error 94: Invalid use of
null error. I can not figure it out. If I remove the event procedure on the
On Open property for the form, the form will open and I can select items from
the drop down list, but when I click on the preview button, the form simply
disappears. If I try to run the report, Access crashes. The On Open Event
Procedure is listed below.

Private Sub Form_Open(Cancel As Integer)
Me.Caption = Forms![Store Report].OpenArgs
End Sub
Private Sub Preview_Click()
If IsNull(Me![Store]) Then
MsgBox "You must select a store from the drop down list."
DoCmd.GoToControl "Store"
Else
Me.Visible = False
End If
End Sub

any help would be greatly appreciated.

Re the error 94, the problem is clearly that Forms![Store Report] was opened
without a value being supplied for OpenArgs. The problem needs to be
addressed at the point where that form is opened, wherever that might be.

Presumably the form disappears because Store is not null. In that case, the
statement Me.Visible = False will be executed (to make the form invisible
i.e. disappear), and that's it! There's nothing else there!
Thanks for the information, Brian.

Here is the code that opens the form:

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub
Private Sub Report_Close()
DoCmd.Close acForm, "Store Report"
End Sub
Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Store Report", , , , , acDialog, "Store Summary"
If Not IsLoaded("Store Report") Then
Cancel = True
End If
End Sub
 

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