Query not showing results?!

JEA

Registered User.
Local time
Today, 13:56
Joined
Nov 2, 2007
Messages
83
Code:
SELECT Training.ID, Training.StaffPIN, Training.Module, Training.DatePassed, Training.DateExp, Training.Comments
FROM TrainingModules INNER JOIN Training ON TrainingModules.[TrngModule] = Training.[Module]
WHERE (((Training.StaffPIN)=[Forms]![TrainingFrm]![StaffPIN]));

Does anyone know why this query isn't working? It doesn't throw an error, it's just not showing any records.

The only thing I can think of is:
Training.StaffPIN is a long int
When it prompts me for [Forms]![TrainingFrm]![StaffPIN] I enter '12177' in the message box, is that taken to be an int or is it actually a text string?

It might not be this as when I use the form [TrainingFrm] to pass the perameter, it's taken from a combobox ([StaffPIN]) where it IS an int, and the query is still blank. :confused:


TrainingModules is a table that stores all the possible modules or subjects that a member of staff can be trained in
Training is a table that stores which staff member has passed which module or subject.
I want the query to pull all the info on a staff member from Training to be later used as a subform.
 
Firstly tou don't need the ' round 12177 when you input it if it is an int.
Secondly are you sure there is a record with StaffPIN = 12177.
Thirdly is StaffPIN defined as INT in the table.

If you are still having problems it would help if you can post the relevant bits of your DB
 
Two possibilities spring to mind.

1) TrainingModules.[TrngModule] and Training.[Module] don't have any common values that relate to the parameter you have entered
2) StaffPIN is both the name of a field in the dataset and a control on the form to which it is bound. This can cause unpredictable reults and my be contributing to your problem. (I know that Access does this by default when you use the form wizard, but it's poor practice).
 
Thanks for the prompt reply!

Firstly tou don't need the ' round 12177 when you input it if it is an int.
Secondly are you sure there is a record with StaffPIN = 12177.
Thirdly is StaffPIN defined as INT in the table.

If you are still having problems it would help if you can post the relevant bits of your DB

I'm not typing the '. It was just ment to show the begining and end of what I was typing.

Yes there is a record in the table [Training] where StaffPIN = 12177

Yes, it's defined as a long integer.

Sorry, I should have pre-empted those questions in my original post. :o

Two possibilities spring to mind.

1) TrainingModules.[TrngModule] and Training.[Module] don't have any common values that relate to the parameter you have entered
2) StaffPIN is both the name of a field in the dataset and a control on the form to which it is bound. This can cause unpredictable reults and my be contributing to your problem. (I know that Access does this by default when you use the form wizard, but it's poor practice).


Point two seems quite likely, I shall investigate....

Thanks to you both for the replies. :)
 
Two possibilities spring to mind.

1) TrainingModules.[TrngModule] and Training.[Module] don't have any common values that relate to the parameter you have entered

Problem solved (due to typo!)

:o :o :o :o :o :o :o
 

Users who are viewing this thread

Back
Top Bottom