B
Brian
Hello,
I've been reading and reading, and I've tried every suggestion I've
found, and I'm still having trouble.
I keep a database with 2 tables: Students and Classes
I have a Form that has a subform in it. The main form and subform are
based on different queries. The 2 queries pull from their own table.
Primary Key and Forrign Key = SSN. Form works great. Form is called
frmActiveEmployees.
What I want to do is print a form exactly the way I see it, minus a
few things. What I've done is, set up a blank report in design view.
The first thing I did was add a subform/subreport and pointed it to my
Form that I love so much. I named this report rptActiveEmployees.
From here, I was able to crop out some unwanted items on the subform.
I set up a command button from the frmActiveEmployees to print the
current displayed record to the report. The problem is the report
always shows the first person in the table. I'm trying to link the 2
on the SSN.
The text box on the form holding the SSN of the current record is
called txtSSN. All around my SSN's are stored as 9 digit numbers, but
I use an input mask for it. The problem may be that the form text box
for SSN is holding 11 digits, 2 extra for the dashes, but the table is
only saving the numbers.
Here is the current code I am using, that doesn't quite work:
Private Sub CmdPrint_Click()
On Error GoTo Err_Print_Click
Dim strWhere As String
Dim stDocName As String
strWhere = "[SSN]=" & "'" & Me![txtSSN] & "'"
stDocName = "rptActiveEmployees"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
Hope I gave enough detail. Thanks.
Brian
I've been reading and reading, and I've tried every suggestion I've
found, and I'm still having trouble.
I keep a database with 2 tables: Students and Classes
I have a Form that has a subform in it. The main form and subform are
based on different queries. The 2 queries pull from their own table.
Primary Key and Forrign Key = SSN. Form works great. Form is called
frmActiveEmployees.
What I want to do is print a form exactly the way I see it, minus a
few things. What I've done is, set up a blank report in design view.
The first thing I did was add a subform/subreport and pointed it to my
Form that I love so much. I named this report rptActiveEmployees.
From here, I was able to crop out some unwanted items on the subform.
I set up a command button from the frmActiveEmployees to print the
current displayed record to the report. The problem is the report
always shows the first person in the table. I'm trying to link the 2
on the SSN.
The text box on the form holding the SSN of the current record is
called txtSSN. All around my SSN's are stored as 9 digit numbers, but
I use an input mask for it. The problem may be that the form text box
for SSN is holding 11 digits, 2 extra for the dashes, but the table is
only saving the numbers.
Here is the current code I am using, that doesn't quite work:
Private Sub CmdPrint_Click()
On Error GoTo Err_Print_Click
Dim strWhere As String
Dim stDocName As String
strWhere = "[SSN]=" & "'" & Me![txtSSN] & "'"
stDocName = "rptActiveEmployees"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
Hope I gave enough detail. Thanks.
Brian