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

how to open access report of specific searched record (need help plz) 2

Status
Not open for further replies.

sadasdasd

Vendor
Dec 12, 2008
4
JO
hi my name is jameel, and i am doing a library database for my school, i am almost done with the project, ther is only one thing that i need help with.

ok so i made a form which is based on a search query (parameter query), now i want to place a command button attached with a vba code in the form, i want this command to preview/print all the records in the query-based form (only the records that i searched for), i do not mean only one record, i need all the record based on my search to be previewed in a report.

i attached a database to show you what i mean, and where i want to place the button

any help will be really appreciated
thanks in advance

 
Your form shows the name of the language, so you can use the where argument of open report, for example:

DoCmd.OpenReport "rptReport", acViewPreview, , "Language='" & Me.language & "'"

 
thanks alot for yor help remou, the code that you gave me worked, now i have a very small problem, the original source of the fields in my project consist of 2 words (eg. BOOK TITLE) and the problem is that code is not working when i place 2 words, it only works for one word
i mean that

DoCmd.OpenReport "rptReport", acViewPreview, , "BOOK TITLE='" & Me.BOOK TITLE & "'"

the above code for the field turns to give me a syntax error

i would really appreciate it if u help me
thanks in advance
 
DoCmd.OpenReport "rptReport", acViewPreview, , "[BOOK TITLE]='" & Me![BOOK TITLE] & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It is never a good idea to have spaces in the names of fields and controls, as you are now finding out. It is also best to rename controls so they do not have the same name as the field they contain. It is best to use a suitable naming convention (eg There is a way around, but I strongly recommend that you fix things up before it goes too far:

DoCmd.OpenReport "rptReport", acViewPreview, , "BOOK TITLE='" & Me.[BOOK TITLE] & "'"
 
thanks alot both Remou and PHV for your help, i am really thankfull for your help

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top