dislpaying result in a form

andyswinburne

Registered User.
Local time
Today, 02:47
Joined
Sep 29, 2003
Messages
22
I'm having trouble displaying a single record in a form, i have a query which returns the correct data (ie. the required record) but this is in a datasheet format, is there any way to display this in a form or translating this querie to open the form showing the record

here is the SQL query:

SELECT Bowlers.[Bowler ID], Bowlers.[First Name(s)], Bowlers.Surname, Bowlers.[Date Of Birth], Bowlers.[Phone Number], Bowlers.[E-mail], Bowlers.[Web Site], Bowlers.Selected
FROM Bowlers
WHERE ((Bowlers.[Bowler ID])=(Forms!Teams!BowlerID1));

basically finds the record an ID on another form (teams) and i want to display it in [Bowler Details]
cheers

andy
 
Assuming your Bowler Details form is based on the bowler ID, you can use the OpenForm method with the criteria set to the ID of the specific bowler you want to view the details of. Create a command button with the following onClick code:

DoCmd.OpenForm "Bowler Details", , , [Bowler ID] = Forms!Teams!BowlerID1
 
Yeah i have tried this and had no luck, i try:

DoCmd.OpenForm "Bowler Details", , , BowlerID = Forms!Teams!BowlerID1

this loads the form with only one record but all fields are blank apart from bowlerID which has autonumber, will this field being an automnumber make a difference?

if i try:

DoCmd.OpenForm "Bowler Details", , , [BowlerID] = Forms!Teams!BowlerID1

then i get the error:

can not find fields 'l' referred to in your expression.

The name of the field is [BowlerID] for the form and [Bowler ID] for the table, know this is bad practice, could this have something to do with it?

cheers

andy
 
The command button wizard will create the code for you, just select the option to select a specific record
 
problem solved!

i just ran the query then created an autoform on that result, did the trick.
 

Users who are viewing this thread

Back
Top Bottom