Open New Form as Sub Form

T

twalsh

I have Form and the point eventually will be to have 2 weeks of payroll data
side by side. So naturally I want to have 2 side by side subforms, both
eating off the same query of the payroll data.

above each half/subform i want a text box where you can select your payroll
date and change what's in the subform. So for example in the left hand side
you can view the first week of august and in the right hand form you can view
the first week of september.

right now i have a simple form that can open each week of data in a new form
using the command button wizard i came up with the below code, how do i alter
it to display the data in a subform instead??

Private Sub cmdOpenAcctView_Click()
On Error GoTo Err_cmdOpenAcctView_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmACCTPayrollData"

stLinkCriteria = "[WEEK]=" & "#" & Me![txtWeek] & "#"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenAcctView_Click:
Exit Sub

Err_cmdOpenAcctView_Click:
MsgBox Err.Description
Resume Exit_cmdOpenAcctView_Click

End Sub
 
K

Klatuu

It would be very similar
In the record source query for each of the subforms, filter the query based
on the value of the textbox, then in the After Update event of the query,
requery the subform.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top