Returning to msAccess

mba1942

Registered User.
Local time
Today, 09:56
Joined
Apr 5, 2012
Messages
16
I've had some experience in msAccess 2003 but am returning after a few years leave for service work in Russia. Am currently using msAccess 2007.
I am presently involved in trying to learn how to print a report using a single record ID. The report would be called based on testing an entered parameter within the form. The record has an ID number which I want to pass to the report calling module.

mba1942
 
You use the Where clause of the open report DoCmd.
eg
Code:
strWhere = "[LDPK] = " & LoanRef
       
    DoCmd.OpenReport "RptStatementNewStyle", acViewPreview, , strWhere
 
First, welcome to the forum.

Just a word about your effort to print a report related to a single record. You are quite correct when you indicate that you need to use the ID of the desired record. However, I would assume that each of your records would have some human recognizable data. I would like to have you think in terms of presenting your user with some information that would allow them to identify the correct record and not have them have to try to remember some record ID number. You can do this with the use of a list box or a combo box and still have the Record ID be available for the selected value.
 
Thanks so much for your quick response!
I may not understand completely your response... Sorry for being so obtuse!

To explain further, the client is simply adding his contact data to fields in a sign-in form. [Which is uniquely identified by the auto-numbered 'VisitID" field]. Once he has completed the form, the entered data is transfered as header information to a worksheet report form which contains other fields that are mostly handwritten and are defined actions based on the results of the client/rep. visit.

It is hoped that the form (record) can be printed to the worksheet by internally capturing a unique identifier (such as "VisitID") and passing it as a parameter to the DoCmd.OPenReport .... Is this the correct path to take? If yes, how do I capture the unique paramater?
 
Yes, the correct path is exactly as you have described. You can pass the record id as part of the parameter of the DoCmd.OPenReport method.

I was not understanding just how the record ID was going to be obtained and was afraid that you might be expecting your user to remember it or to just enter it. Sorry for not understanding all of what you were attempting to do.
 
Prior to the task of opening the next Report or Form using the Where Clause, you can oddles of Code that constructs your Where Clause.

If the current Form already has a Unique Identifier for that person then you just refer to that - one or two lines of code.

If not, you just need to find the shortest road to that unique identifier and use sql in your code to identify the link.
This could include saving the record (where a new Customer has been created) getting the new Unique Identifier and populating your Where Clause.

As you build this, advice is available.
 

Users who are viewing this thread

Back
Top Bottom