Here's the code for the button click.
Code:
Private Sub OpenButton_Click()
Dim recordID As Integer
recordID = Me.TimecardID
DoCmd.OpenForm "Timecards", , , "TimecardID = " & recordID
End Sub
One thing that is different between the first form (the one that worked fine) and this one: the Control Source for the first one was based on a table. The Control Source for this one is a Query. I did it that way because I needed to show the employee's name in this new one, and their name came from a different table. So I created a Query to allow me to show all the data I wanted to see. I don't want my user to be able to make any changes to the data, so I have locked the text boxes on this form... at least I think I have. Maybe by doing that I messed something up with my button?
I don't know if this would have anything to do with it, but here is the SQL of the Query.
Code:
SELECT T_Timecards.WeekEnding, T_Timecards.TOTALAMT, T_Timecards.BoxRentalTotalAmt, T_Timecards.MileageTotalAmt, T_Timecards.NumberDaysWorked, T_Timecards.PrintedAlready, T_Timecards.JobID_notFK, [Q_Employees on Jobs].CombinedName, T_Timecards.TimecardID
FROM [Q_Employees on Jobs] INNER JOIN T_Timecards ON [Q_Employees on Jobs].[EmployeesOnJobsID] = T_Timecards.[EmployeesOnJobsID];