Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 20th, 2003, 02:01 PM
theocpcguru theocpcguru is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 3 theocpcguru User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Print Access Report - VB6

I've got an report in an access2k db that i'm trying to print from a vb6 from end. I want to filter the report down to print a single record, which is identified by the ID Field (autonumber).

here is my code..

Private Sub cmdprintticket_Click()
Dim acApp As Access.Application
Dim StrSQL As String
StrSQL = "[ID]=" & Me.Text2.Text
Set acApp = New Access.Application
acApp.OpenCurrentDatabase "Z:\Front End\AeCorpR3.mdb"
acApp.DoCmd.OpenReport "Service_Call", acViewPreview, , StrSQL
acApp.DoCmd.Printout
acApp.Quit
Set acApp = Nothing
End Sub

I've tried using the variable NewRecordID as well as making the autonumber show in a text box (text2) but it prints the report, just not the record i'm specifying... it prints another record.... What in the world?

Please let me know what it's doing.

I'm using ADO and an access 9.0 object library.

Chris

Reply With Quote
  #2  
Old September 19th, 2003, 04:42 AM
Sadhanandh Sadhanandh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Chennai, India.
Posts: 5 Sadhanandh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 53 sec
Reputation Power: 0
Smile

Hi
You should use a filter to set filter to the required row count and then proceed with the report preview.

Reply With Quote
  #3  
Old September 19th, 2003, 04:48 AM
Sadhanandh Sadhanandh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Chennai, India.
Posts: 5 Sadhanandh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 53 sec
Reputation Power: 0
Hi

The following code should do the trick

Just before you preview the report,

DoCmd.ApplyFilter , "[ID] = '" & Me.Text2.Text & "' "

IF the ID is a numeric do not enclose the value within single quotes, else do so.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Print Access Report - VB6


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT