Hi, Dawn. Thanks again for your help. I did everything you listed for me, but it didn't help. I never was able to get a combo box, even when executing the query. I get the same window for putting in the artist's name, but now instead of "Which Artist?", it shows the name of the combo box. Also, when I ran the report, rather than put an artist's name on the report, I get "#Name?"
--- In [email protected], "Crosier, Dawn" <[EMAIL PROTECTED]> wrote: > > No problem, you are very close. > > 1. Create a form. Name the form frmSelectArtist. The form itself > should not have a record source. > 2. On the form, create the combo box. The record source of your > combo box will be your Artist Names. When looking at the combo box on > screen in design view, it should say Unbound. > 3. Name the combo box, cboArtist. > 4. Change your query so that instead of [Which Artist?] it says > [Forms]![frmSelectArtist].[cboArtist]. > 5. Turn off the Magic Wand before you create the command button > that you will use to open your report. This will ensure that no code > gets created which you would have to delete. > 6. Name the command button cmdPreviewReport. > 7. Open the Properties dialog box for the command button. > 8. Locate the Click Event. Click the Build Button. Select the > Code Builder Option. Place the following bit of code between the > "Private Sub cmdPreviewReport" and the "End Sub" lines. > > On Error GoTo EH > Dim stDocName As String > > stDocName = "Artist Report" > DoCmd.OpenReport stDocName, acViewPreview, "qryArtist" > > DoCmd.Close acForm, "frmSelectArtist" > 'Handle Errors Gracefully > Exit_EH: > Exit Sub > > EH: > MsgBox Err.Number & ": " & Err.Description > Resume Exit_EH > > 9. Change the "Artist Report" to the name of your report. Be sure > to leave the report name inside of the quotes. > 10. Change the "qryArtist" to the name of your query. Be sure to > leave the name of the query inside of the quotes. > 11. Create a field on your Report where you want your Artist Name to > print. > 12. In the Control Source of that field, put in > =[Forms]![frmSelectArtist].[cboArtist] > > Let me know how that works for you. > > Dawn Crosier > Application Specialist > "Education Lasts a Lifetime" > > This message was posted to a newsgroup. Please post replies and > questions to the group so that others can learn as well. > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Garry > Sent: Thursday, March 23, 2006 10:55 PM > To: [email protected] > Subject: [ms_access] Re: Report help > > Okay. I accidentally was able to build a query that would return > results for an artist who appeared in any of the five artist fields. I > built a report on that. > I'm getting close to what I want. I entered [Which Artist?] as a > parameter in my query, staggered in each of the artists fields. > Unfortunately, I have to actually type in the artist's name, so if I > make a typo, it won't work. I would rather work from a combo box, but I > don't know how to do a parameter as a combo box. > Also, I would like to put the artist's name at the top of my report, but > it seems like I have to select either Artist 1, Artist 2, or Artist 3, > etc. I don't know how to put the name of the artist I selected as the > parameter to show up in a label on my report. > Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
