Pulling out my hair! Help with creating macro (1 Viewer)

Tina49

Registered User.
Local time
Today, 04:49
Joined
Sep 29, 2011
Messages
34
I am updating a database from Access 1995 (yes) to Access 2007. Due to the macro and calculated fields, I can not update this database to 2000, then to 2003, then to 2007. It simply won't update. So I am re-creating the database. I have a form that takes the results from option buttons (which picks which report to generate), so an if statement. There are also several combo box fields in which the user can pick user name, date, class. etc. I copied the Macro into a word document and pasted it into the 2007 document. Set up all the fields; however, as expected it did not run. I don't do programming very well, so I do not understand exactly what is failing. Here is the code:

Private Sub Command12_Click()
Dim res As Recordset
Dim Chz As Integer
Chz=Forms!Edreports!Frame0

Ok, this is where the debugger stops with an error on Frame0 . (Run-time error 2465: Can't find the field Frame 0 referred to in your expression. What exactly does this mean? I simply don't see any field that is referred to as Frame0 in the database. The rest of the code is below.

If Check63 Then
Chz=Chz*10
End If
Select Case Chz
Case 1 'Attendance Report
IfIsNull(Combo31) Then
DoCmd.OpenReport "EdRep4a", acPreview 'for Class
Else
DoCmd.OpenReport "EdRep4b", acPreview 'for Employee
End If
Case 2 'Non Attend Reminder List
DoCmd.OpenReport "EdRep6", acPreview
Case 3 'Non Attend Reminder List
DoCmd.OpenReport "EdRep5", acPreview
Case 4 'Annual Report
DoCmd.OpenReport "EdRep0", acPreview
Case 5 'Print Names
DoCmd.OpenReport "EdRep7", acPreview
Case 6 'Print Appraisal by date
DoCmd.OpenReport "EdRep6", acPreview
Case 10 'Class by Department-Break by Department
DoCmd.OpenReport "EdRep4", acPreview 'for Class
Case 20 'Non Attendance Reminder List- Break by department
DoCmd.OpenReport "EdRep4b", acPreview
End Select
End Sub
 

jzwp22

Access Hobbyist
Local time
Today, 07:49
Joined
Mar 15, 2008
Messages
2,629
Typically a frame is referring to the option group (in which your check buttons are located), so you will need to check the name of that option group and verify that it is indeed named frame0. By the way, if the option group and the command button (command12) are on the same form, you do not need the full form reference

This: Chz=Forms!Edreports!Frame0 can be simplified to this: Chz=me.Frame0
 

Users who are viewing this thread

Top Bottom