473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to enter print preview report's filter automatically from the current form

13
I have an agreement template in a MS access report. The report's fields are populated by the form's records. my goal is to automate the report to filter to the agreement # to what ever the current agreement # on the form is. i do not want to have to enter the agreement # every time i click on the cmd function to preview the report. below is the code i have, can someone please edit my code to what it should be?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command99_Click()
  2. On Error GoTo Err_Command99_Click
  3.  
  4.  
  5. 'Defines Variables:
  6.     Dim stReportName As String
  7.     Dim stFilter As String
  8.  
  9.     'stFilter = [Agreement#].Value
  10.  
  11.     stReportName = "rptLicenseAgreement"
  12.     DoCmd.OpenReport stReportName, acPreview, , stFilter, acDialog
  13.  
  14.  
  15. Exit_Command99_Click:
  16.     Exit Sub
  17.  
  18. Err_Command99_Click:
  19.     MsgBox Err.Description
  20.     Resume Exit_Command99_Click
  21.  
  22. End Sub
  23.  
  24.  
thanks!
Jan 27 '12 #1
1 2805
NeoPa
32,556 Expert Mod 16PB
No. They can't. That is not an acceptable request here.

Look at Example Filtering on a Form and learn to do it for yourself.
Jan 28 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
0
by: Malcolm Cook | last post by:
I've discovered: Using "File > Print Preview" in a form's datasheet view with a server Filter crashes access after previewing... ....that is, unless ServerFilterByForm has been turned off...
3
by: sea | last post by:
I need to be able to print the current form because the form has an embedded object of a .gif file, so report will not work -- does anyone know the way to do this? I tried some code, not sure what...
2
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
2
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default...
2
by: Lark | last post by:
Hello and help. Im a novice to access but pretty good with word and excel, My access form will not show up in the preview mode? I checked params like box sizes and page layout but there is no...
4
by: John Torres | last post by:
I have added a "Preview Report" button on my main Form Page to mainly "print preview" current page including the 1st subform and I already designed the Report Page for it. But for some reason it...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
4
by: scubasteve | last post by:
I've developed a product pricing application for a client in AC2007. They enter all the data on the one main form, then click a button to open a printable report in Print Preview. My problem...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.