Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preview Report based on text box completion

Status
Not open for further replies.

b3026

Programmer
Jun 23, 2004
5
US
Hopefully my subject makes sense.

I have a database written for processing a quote to be sent to customers.

If the text box containing a cash incentive is completed, I need the "Preview Quote" box when clicked to print one particular report (which includes the cash incentive). If there is nothing in the cash incentive box on the form, I need another report which does not include the cash incentive to preview.

All help is appreciated.

Thanks.
 
If Trim(Me![cash incentive textbox] & "") = "" Then
stDocName = "name of report without cash incentive"
Else
stDocName = "name of report with cash incentive"
End If
DoCmd.OpenReport ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Code:
Private Sub cmdOpenReport_Click()
  If Me![txtIncentive].Value = "" Then
    DoCmd.OpenReport "rptNoIncentive", acViewPreview
  Else
    DoCmd.OpenReport "rptIncentive", acViewPreview
  End If
End Sub

In the report with incentive, have the controls that need the incentive amount reference the form, such as:

[tt]=Forms![frmMain]![txtIncentive][/tt]

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top