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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print 1 record from a access report

Status
Not open for further replies.

testeng

Technical User
Apr 5, 2001
32
US
I am trying to get VB6 to open a access report and only print one record from a table. I can get access open and print a report but it prints all of the records in the table. If I were to pick one field, from the table, as an identifier what would be the command string that would make it work?
 
Hi,

After you have the Access database open, you could set the Filter Property to select only the chosen record, something like:

Dim x as Access.Report
Dim strSQL as string

Set x = YourAccessAppObject.Reports.Item("YourReport")

strSQL = "SELECT * FROM tblYourTable WHERE fldPKey = " & _
"YourUniqueValue"
with x
.Filter = strSQL
.FilterOn = True
end with

'Print your report & turn the filter off.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top