On my menu form, I have a command button that takes me to a data entry form, frmTime. Via code, I am trying to open up frmTime so it displays one record/row for each day of the current month for the employee who is logged in. The form would look something like:
[In the header]
Employee: Bill Smith
DATE TIME
[In the details]
7/1/2011 2 hours
7/2/2011 .75 hours
7/3/2011 1.5 hours
...
7/31/2011 1.25 hours
I have the code for strSQL working (ie, when I put it directly in a query, it pulls the correct records and I can update the time). However, I'm having trouble getting the record source of the form to update with strSQL. Here's what I had working on Click for the command button on the menu form, but now it's not changing the record source:
strSQL = "SELECT..."
DoCmd.Close
DoCmd.OpenForm "frmTime"
Forms!frmTime.RecordSource = strSQL
In fact, in testing, I created and saved a query, qryEmployeeMonth, with the same code that I used above. Then I set the Record Source of the form to qryEmployeeMonth. Even this didn't open anything in my form. Could I have changed a setting in the form that is prohibiting this from changing?
Thanks!
Anna Jaeger
iMIS Database Support
[In the header]
Employee: Bill Smith
DATE TIME
[In the details]
7/1/2011 2 hours
7/2/2011 .75 hours
7/3/2011 1.5 hours
...
7/31/2011 1.25 hours
I have the code for strSQL working (ie, when I put it directly in a query, it pulls the correct records and I can update the time). However, I'm having trouble getting the record source of the form to update with strSQL. Here's what I had working on Click for the command button on the menu form, but now it's not changing the record source:
strSQL = "SELECT..."
DoCmd.Close
DoCmd.OpenForm "frmTime"
Forms!frmTime.RecordSource = strSQL
In fact, in testing, I created and saved a query, qryEmployeeMonth, with the same code that I used above. Then I set the Record Source of the form to qryEmployeeMonth. Even this didn't open anything in my form. Could I have changed a setting in the form that is prohibiting this from changing?
Thanks!
Anna Jaeger
iMIS Database Support