Rabu, 24 Februari 2016

RE: [MS_AccessPros] Need help with a Report


Hi Kat

I take it this happens when you select option #8.

Does the RecordSource for the report R_TrnHist4SpecificEmp include a field named C_Desc? If not, then this would explain the error.

Also, you have a glaring problem with Me.Name. "Name" should be avoided as a name for fields and controls, because almost every object in Access has a Name property. In this case, Me.Name will give you the name of your form!

You could try using Me![Name], but you would be much better to rename that field.

Best wishes,


Graham Mandeno
Microsoft Access MVP 1996 - 2015

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of ka0t1c_ang3l
Sent: Thursday, 25 February 2016 05:38
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Need help with a Report

Hi Duane!

Thanks so much for your reply. Please know that I am a novice when it comes to coding, so your help is greatly appreciated!! I put in the code you gave me for my "View Report" button...here is the code for the button:

Private Sub Command93_Click()

Dim strReport As String

Select Case Me.RptOpt
Case Is = 1
strReport = "R_TrainingHistConfig"
DoCmd.RunMacro "TrainingHistConfig"
Case Is = 2
strReport = "R_TrnTrxnClassRoster"
DoCmd.RunMacro "TrnClassRpt"
Case Is = 3
strReport = "R_TrainingClassDetail4DateRange"
DoCmd.RunMacro "TrainingbyDateRanges"
Case Is = 4
strReport = "Report all Active Emp"
Case Is = 5
strReport = "R_Active Emp By Dept"
Case Is = 6
strReport = "R_TrnTrxnScheduleDateRange"
DoCmd.RunMacro "TrainingScheduleDateRange"
Case Is = 7
strReport = "R_TrnTrxnClassRosterDateRange"
DoCmd.RunMacro "TrainingClassRosterDateRange"
Case Is = 8
Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.Name) Then
strWhere = strWhere & " AND [Name] = """ & Me.Name & """ "
End If
If Not IsNull(Me.CDesc) Then
strWhere = strWhere & " AND [CDesc] = """ & Me.CDesc & """ "
End If
' add more controls and where conditions

strReport = "R_TrnHist4SpecificEmp"
DoCmd.OpenReport "R_TrnHist4SpecificEmp", acViewPreview, , strWhere

End Select

DoCmd.Close acForm, "f_ConfigRpts"
DoCmd.OpenReport strReport, acViewPreview

End Sub

When I select an employee name and a class description, and select the training history for specific employee option button, and click on the view report button, a "Enter Parameter Value" for the CDesc comes up. I've check the labels for my combo box on the form, and the text box on the report, and they are corrent. I'm not sure what I'm doing wrong.

Thanks so much for your help!


[Non-text portions of this message have been removed]


Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)



Tidak ada komentar:

Posting Komentar