Help with printing only one record in a report

brian0721

Registered User.
Local time
Today, 03:45
Joined
Dec 5, 2001
Messages
103
Okay, im not really all that experienced with access, so this might be easy for everybody else, but here goes. I made a database for my boss at work. We store loan information, names, amounts, addresses, etc. In it, I have a report that will take the name, address, etc, and put it into a letter and print. Here is my problem, once we start having more than one name in the database, it wont print properly, because it is seeing more than one name in each field. How do i go about making it so that i can pick a certain name and then make the report use that information. Can i make a drop down list with the client names that automatically updates, and then will print a report for THAT SPECIFIC person? Any help would be greatly appreciated. This is very important. Thanks again!

Brian
 
I assume that each customer (record) has a unique ID. If you have an unbound form with an unbound combo box that has the ID and customer name as column 1 and column 2 in the combo box then this this will work for you. On the form with the combo box add a command button and use this code for the On Click [Event Procedure]

DoCmd.OpenReport "ReportNameHere", , , "[IDFieldNameHere] = " & Me.ComboBoxNameHere

I have assume that the ID is a number and not a string and that the unique identifier (ID) is in the first column in your combo box.

You can put the command button on your existing customer form if you like and get the ID from the ID field on the form instead of using a combo box.

There are other ways to skin this cat if you want to print more than one record at a time, but this will do the one record thing just fine.

hth,
Jack

PS. No cats were hurt in the creation of this response....
 
More questions...

Thanks for the help, i did what you said, i made the combo box, and i put the code in, but it doesnt like the last part, the "comboboxnamehere" i changed it obviosuly and it still doesnt work. Could you please help me some more.
 
More questions...

Thanks for the help, i did what you said, i made the combo box, and i put the code in, but it doesnt like the last part, the "comboboxnamehere" i changed it obviosuly and it still doesnt work. Could you please help me some more.
 
This is a bit hard to figure out without seeing what you have done, but here are some things to look at.

1. The first physical column of data in the combo box is the unique record identifier.

2. The unique identifier is a number.

3. The report and field names are not misspelled in the line of code.

If all three of those items are correct then the code should work. If, after checking, it still does not work then tell me what error you are getting when you run the code.

hth,
Jack
 
Okay, first of all, thanks for the help so far. I am getting somewhere without error messages now atleast, but still not where i am trying to get. Here is what I have as far as objects go. (keep in mind this is not the database i am using, i am just trying to figure it out using this test db. I have a TABLE called "Main", I have a FORM called "Main F", I have REPORTS called "Main R" and "Test." When I put in that code that you gave me earlier, I made it so that it said... "
Private Sub Command15_Click()
DoCmd.OpenReport "Main R", , , "[TEST] = " & Me.Combo12
End Sub

When I click the button it brings up a dialog box wanting me to enter a parameter value for "TEST" It then asks for a parameter value for the Loan number that I am on. I am confused, but not surprised, because I do not know that much about this kind of stuff. Anyways, any more help would be greatly appreciated. If you want, I could email you this db and you could see what I have going. Thanks again!
 
You mention a LoanNumber. If this is your unique ID and it is in the first column in your Combo box then this code should work:

DoCmd.OpenReport "Main R", , , "[LoanNumber] = " & Me.Combo12

If LoanNumber is a String and not a Number then use this code:

DoCmd.OpenReport "Main R", , , "[LoanNumber] = '" & Me.Combo12 & "'"

If you still cannot get it to work then zip up your db and email it to me and I will see if I can sort it out for you. No guarantees but I will give it a shot. (I have Access97 and Access2000. If you have Access2002 you will have to save it as a previous version.)

hth,
Jack
 

Users who are viewing this thread

Back
Top Bottom