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

Query Lookup

Status
Not open for further replies.

myuserid7

MIS
Mar 2, 2005
111
ES
Hi,

Trying to create a query to get data from a table, but I want the criteria to to use data that is currently in on of the fields.

"Faults reported" is the record
"Fault number" is one of the fields.

I want the query to look at the current record it is on (eg : fault number 13) and bring back all the info for that fault number.

Hope this makes sense.

Thanks for any help.

Scott
 
Are there any forms related to this question? There should be. Terms like "bring back" and "look at" don't accurately suggest what you have or what you want.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
ok, here goes.

The form is called 'Faults'
I am on fault number 23 which has loads of other info on it such as fault number, fault type, fault location, fault reported by, etc, etc

I want to have a button on my form which when clicked will print the data for that particular fault number (report form which I will create the look of).

So clicking the button will print off a report with all the info the record I am currently on. If I clicked file and print it would just print off all 3000 faults in the format shown on the screen.

Hope this makes it clearer. Thanks for helping.

Scott
 
Create a command button to open the report. Then go back and modify the code to something like:
Code:
Dim strWhere as String
strWhere = "[Fault Number]=" & Me.txtFaultNumber
DoCmd.OpenReport "rptYourName", acPreview, , strWhere
This assume [Fault Number] is numeric and the control bound to [Fault Number] on your form is named txtFaultNumber. Your report will also have a different name.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Microsoft SQL Query

I have a SQL data base which has very little reporting functionality, therefore I use ms query via Excel.

This I have little working knowledge but can get most reports created.

I have created a spread sheet which accesses the query and returns the information as required.

What I would like to do is open the spread sheet and either add another worksheet to the spreadsheet and have a key word to use as a input into the query OR get the query to prompt for input on opening.

I can get this to work if I edit the query each time and use like '%text%' and this works ok, but I can't seem to get the like funtion to work as a prompt.

If I set the like function as : like [ enter text ]

this will give me a pop up which I can enter text, but the search is then a literal search and doesn't use wildcards, does anyone know how to get this "prompted" search to use wild cards?

Any help would be very very much apprecaited.

Regards
KeefB

[lightsaber]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top