Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VB debug error help printing report 1

Status
Not open for further replies.

jtzpto

IS-IT--Management
Jul 29, 2004
2
US
Hi, I have Access 2003, current on updates, installed on XP SP2. I have a problem trying to print a specific report. When I try, I receive an error that says
Microsoft Visual Basic
Run-time error '94':
Invalid use of Null

Then I have the option to debug and the line in question
that is causing the problem reads:
MyTable("Series") = MySet!Series
Can anyone help? Other reports print fine, it's just this specific report. Below is the entire code it brings up when I click debug, incase that helps. Thanks so much for any help or suggestions!
Danielle

Option Compare Database 'Use database order for string comparisons

Private Sub BtnEdit_Click()
On Error GoTo Err_BtnEdit_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Edit Menu"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_BtnEdit_Click:
Exit Sub

Err_BtnEdit_Click:
MsgBox Error$
Resume Exit_BtnEdit_Click

End Sub

Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click


DoCmd.Close

Exit_btnExit_Click:
Exit Sub

Err_btnExit_Click:
MsgBox Error$
Resume Exit_btnExit_Click

End Sub

Private Sub BtnMaintenance_Click()
On Error GoTo Err_BtnMaintenance_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Library Maintenance"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_BtnMaintenance_Click:
Exit Sub

Err_BtnMaintenance_Click:
MsgBox Error$
Resume Exit_BtnMaintenance_Click

End Sub

Private Sub btnPrint_Click()
Dim MyDB As Database, MyTable As Recordset, MySet As Recordset
Dim MySQL, MySeries As String
Dim MyCounter As Integer

Set MyDB = OpenDatabase("C:\Message Label Database\Message Labels (Tape).MDB")
Set MyTable = MyDB.OpenRecordset("Series")
Do Until MyTable.EOF
MyTable.Delete
MyTable.MoveNext
Loop

MySQL = "SELECT [Service],[Series],[Key] from Messages WHERE [Service] = '" & cboService & "' ORDER BY [Key];"
Set MySet = MyDB.OpenRecordset(MySQL)

MySet.MoveFirst
MyCounter = 0
MySeries = "No Series"

Do Until MySet.EOF

If MySet!Series <> MySeries Then
MyCounter = MyCounter + 1
End If
MyTable.AddNew
MyTable("Service") = MySet!Service
MyTable("SortOrder") = MyCounter
MyTable("Series") = MySet!Series
MyTable("Key") = MySet!Key
MyTable.Update
MySeries = MySet!Series

MySet.MoveNext
Loop

MyTable.Close
MySet.Close
MyDB.Close
DoCmd.OpenReport "Catalog"

End Sub

Private Sub BtnRentals_Click()
On Error GoTo Err_BtnRentals_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Customer"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_BtnRentals_Click:
Exit Sub

Err_BtnRentals_Click:
MsgBox Error$
Resume Exit_BtnRentals_Click

End Sub

Private Sub BtnSubscription_Click()
On Error GoTo Err_BtnSubscription_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Subscriber"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_BtnSubscription_Click:
Exit Sub

Err_BtnSubscription_Click:
MsgBox Error$
Resume Exit_BtnSubscription_Click

End Sub


 
Wow,I should have posted this question here long ago. I tried your suggestion and the problem is fixed.
Thank you so much!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top