Wrox Programmer Forums
|
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2005, 06:17 PM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create a report using form data

Hi to all, I have an interesting problem that I hope is solvable, however I could be asking the impossible.

I have a query in my project that retrieves all needed data from three tables to generate a Work Order Report. Right now the query is hard coded for a single Work Order i.e. WHERE WorkOrder.JobNo = 'Job1'. If I want to make a report of another Work Order I have to change the hard coded search parameter, not very flexible. I can set up the query to ask for a work order number i.e. WHERE WorkOrder.JobNo = [Job Number]. When run the query pops up a dialog box asking for a Job Number. What I want to do is have a button on the Work Order form that passes the work order number to the query then displays the report. I need to pass to the query what is in the Work Order form's JobNo text box.

So I guess the question is how can the information in a form's text box be passed to a query that is the basis of a report?

Thanks in advance, Mike Girard.

 
Old February 20th, 2005, 07:24 PM
Authorized User
 
Join Date: Jul 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Modify the command button text to be something like this:

'If JobNo is numeric...
DoCmd.OpenReport "rptMyReport", , , "[JobNo] = " & Me!txtJobNo

'If JobNo is alpha...
DoCmd.OpenReport "rptMyReport", , , "[JobNo] = """ & Me!txtJobNo & """"

...where Me!txtJobNo is the textbox that contains the job number in question.

This kind of question (unrelated to the book) should be directed to the appropriate forum. I suggest posting such future questions to the Microsoft product-specific newsgroups. See the following page for instructions on how to connect to the Microsoft newsgroups.

http://www.pacificdb.com.au/MVP/newsgroup.htm

Graham R Seach
Microsoft Access MVP





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a report that displays the meta data method Access VBA 1 April 4th, 2005 06:40 AM
Create Report in Code sadiku Crystal Reports 0 January 26th, 2005 09:19 AM
How to create a report ractim General .NET 3 November 10th, 2004 03:51 AM
create form kobystud C# 3 July 5th, 2004 09:13 AM
Create an Invoice with Data Report without using D ubaidmt VB Databases Basics 0 April 20th, 2004 10:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.