Hello,
Up until recently I've only used macros to do the dirty work (I understand that most use VBA)... It seems I'm hitting their limitations now and am in need of assistance in getting VBA code to work.
I have a single report that shows employees and the accounts that they are being paid from for a single pay period. The report is fed information from a form.
I have a pull down menu on the form that contains the numbers 1 through 26... these numbers indicate which pay period is being selected and pushed through to the report. The report is supposed to then pull correct account information for the selected employees (also selected from the form). However, I've not gotten the account information to pull successfully with VBA. When using a macro the first record for the pay periods will get pulled and be reported for all employees (i.e. all employees are reported as being paid from the same account as the first listed employee)... I could create report for each individual pay period... but I'd rather not have 26 reports to maintain.
Here is a snippet of the code that I'm having an issue getting to work:
This code pretty much repeats up to 26.Code:Private Sub Report_Open(Cancel As Integer) If (Forms![Front End Navigation Menu]!NavigationSubform.Form!PayPeriodsCombo = 1) Then DoCmd.SetProperty "PPData", , DLookup("[pp1]", "rm_ranged_room_q", "PY_Employee_Info_T_Emp_ID =" & "[PY_Employee_Info_T_Emp_ID]") ElseIf (Forms![Front End Navigation Menu]!NavigationSubform.Form!PayPeriodsCombo = 2) Then DoCmd.SetProperty "PPData", , DLookup("[pp2]", "rm_ranged_room_q", "PY_Employee_Info_T_Emp_ID =" & "[PY_Employee_Info_T_Emp_ID]") ElseIf (Forms![Front End Navigation Menu]!NavigationSubform.Form!PayPeriodsCombo = 3) Then DoCmd.SetProperty "PPData", , DLookup("[pp3]", "rm_ranged_room_q", "PY_Employee_Info_T_Emp_ID =" & "[PY_Employee_Info_T_Emp_ID]") ETC. ETC. End Sub
Thanks for all of your help in advance






