473,320 Members | 1,957 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,320 software developers and data experts.

Report Problem

manoj9849967222
Hi all

I have a form named "Form1" which has two textboxes "Textbox1" & Textbox3" which is ment to enter dates & also a command button "command9"

I have a report named "Report1" which is based on query. The query is working fine.

what i want to do is when the command button is click i want to load the report between the two given dates in the "textbox1" & "Textbox3"

I have tried but is not working. I have used the following codes

Private Sub Command9_Click()
Dim stDocName
Dim stLinkCriteria
stDocName = "Report1"
DoCmd.OpenReport stDocName, , , stLinkCriteria
End Sub

I hope i am missing something in the codes.

Please help me out

Regards
Manoj.
Sep 11 '07 #1
5 1016
margot
48
Hey, I have the same problem. However an easy exit is to do a query.

You create a query with all the fields and on the Date field Type the code below.

Between [Enter First Date ] And [Enter Last Date]

Then you create a report based on the query that you just created. When someone clicks the report they should be able to enter the 2 dates and the report should be created.

Hope this helps.
Sep 11 '07 #2
kjworm
26
You could go the query route, but the missing item in your code is the definition of your stLinkCriteria similar to how you have stDocName="Report1". You need to define this.
Sep 11 '07 #3
Jim Doherty
897 Expert 512MB
Hi all

I have a form named "Form1" which has two textboxes "Textbox1" & Textbox3" which is ment to enter dates & also a command button "command9"

I have a report named "Report1" which is based on query. The query is working fine.

what i want to do is when the command button is click i want to load the report between the two given dates in the "textbox1" & "Textbox3"

I have tried but is not working. I have used the following codes

Private Sub Command9_Click()
Dim stDocName
Dim stLinkCriteria
stDocName = "Report1"
DoCmd.OpenReport stDocName, , , stLinkCriteria
End Sub

I hope i am missing something in the codes.

Please help me out

Regards
Manoj.

You need to create the criteria string for the where clause argument for your report the dates of which are passed to the variable strLinkCriteria and formatted accordingly by the function FORMAT

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim stDocName
  3. Dim stLinkCriteria
  4. strLinkCriteria = "#[NameOfYourField] Between #" & Format(Me!TextBox1, "mm/dd/yyyy")
  5. strLinkCriteria = strLinkCriteria & "# and #" & Format(Me!TextBox3, "mm/dd/yyyy") & "#"
  6. stDocName = "Report1"
  7. DoCmd.OpenReport stDocName, , , stLinkCriteria
  8.  
  9.  

Regards

Jim
Sep 12 '07 #4
Hi Jim

I am not able to view the report. It is directly going to the printer.

Regards
Manoj
Sep 12 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
Hi Jim

I am not able to view the report. It is directly going to the printer.

Regards
Manoj
Hi Manoj

Change line 6 as follows:

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
Sep 13 '07 #6

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

Similar topics

2
by: GC | last post by:
HI, I'am using Crystal Report with visual Studio .NEt 2003 When i make a report using a store procedure, I can not see all the fields of the store proc and i'm suppose to see those fields. I'm...
4
by: deko | last post by:
I can't move a multi-page report to the last record unless I keep the popup form (that defined it's subreports) open. DoCmd.OpenReport "rptStandard", acViewNormal DoCmd.Close acForm,...
7
by: xzzy | last post by:
I need to automate a report in a different database (and thank yous to Terry Kreft for pointing me in the right direction). below is the code with the one line that does not work, marked: 'Does...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
2
by: Rick Caborn | last post by:
I am having a problem with an Access 2000 report getting data from SQL Server 2000. Here are the specifications for it: RecordSource: a stored procedure (tested via query analyzer and working...
4
by: Trevor Best | last post by:
I have a report that's fairly simple, page headers and footers, detail has a subreport in (can vary in length). The customer wanted a signature block for them, their client and 3rd party. This was...
9
by: MLH | last post by:
Trouble is, it doesn't happen every time. Yesterday, for example, it happened only once and not again afterward. Some days ago, a similar situation. Today, well - I tried 7 times straight to open...
12
by: Bill Nguyen | last post by:
What's the VB syntax to run the CR report using the following SP? I use CrystalreportViewer and ReportDocument. Thanks Bill Here's the SP in SQLserver 2K: CREATE proc mysp_ReportSubmission...
7
by: TC | last post by:
I've produced an Access application for a client. For one report, text gets cut-off at the right margin when we print the report. It does this only when we print; it doesn't happen when we view the...
2
by: =?Utf-8?B?UmljaA==?= | last post by:
On my development machine where I have Visual Studio 2005 loaded, I have an app that uses the Report control. I can view data in report format with the Report control -- the data renders OK in the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.