print a record from a command button

  • Thread starter Thread starter Madhup Thakur
  • Start date Start date
M

Madhup Thakur

Win98 / Access 2k
On a Form I wish to use a command button to print a record using two
different reports "Dependents" or "Employee" depending whether field
"DepID" is Null or not. Suggestions are more than welcome.
TIA
M. Thakur
 
The wizard should build the button for you to print a report. Build it for
one report.

Then, open the code and just insert an IF statement.

If you use the wizard code, I would think it would be something like this...

..
..
..
Dim stDocName As String

If IsNull(DepID) Then
stDocName = "SomeReport"
Else
stDocName = "SomeOtherReport"
EndIf

DoCmd.OpenReport stDocName, acNormal
..
..
..
 
I am so glad you could help. Thanx.
M. Thakur
Rick B said:
The wizard should build the button for you to print a report. Build it for
one report.

Then, open the code and just insert an IF statement.

If you use the wizard code, I would think it would be something like this...

.
.
.
Dim stDocName As String

If IsNull(DepID) Then
stDocName = "SomeReport"
Else
stDocName = "SomeOtherReport"
EndIf

DoCmd.OpenReport stDocName, acNormal
.
.
.
 
Back
Top