Query to auto fill field on form

C

carrietom

This is a repost as I think my second question got lost. I'm about to give
up on this and tell the user they have to input the Inspection Frequency
themselves. Basically, I have 3 fields (Risk Level, Risk Type and Downhole
Option). A combination of these should determine a fourth field (Inspection
Frequency). It will either be Risk Level and Risk Type OR Risk Level and
Downhole Option based on which Risk Level is selected. I was struggling with
how to make this into a nested if statement and a kind soul on this site
suggested using a query instead. I have done this and the query displays
exactly what I would expect (SQL below).

I have made this query the Row Source of Inspection Frequency on my form and
on the After Update Event of both Risk Type and Downhole Option I put in Me.
Inspection_Frequenct.Requery but I am obviously missing a step as the
Inspection Frequency field is not filling in based on the data selected. Can
someone please tell me what I am doing wrong? Thanks a lot!!!!!

SELECT Tbl_Inspection_Frequency.Freq_ID,
Tbl_Inspection_Frequency.RiskLevel_ID, Tbl_Inspection_Frequency.RiskType_ID,
Tbl_Inspection_Frequency.Inspect_Frequency
FROM Tbl_D13_Inspect_Freq, Tbl_Inspection_Frequency
WHERE
(((Tbl_Inspection_Frequency.RiskLevel_ID)=[Tbl_Inspection_Frequency]![RiskLevel_ID])
AND
((Tbl_Inspection_Frequency.RiskType_ID)=[Tbl_Inspection_Frequency]![RiskType_ID])
AND
((Tbl_Inspection_Frequency.Inspect_Frequency)=[Tbl_D13_Inspect_Freq]![Inspection_Frequency])
AND
((Tbl_Inspection_Frequency.Dwnhole_ID)=[Tbl_Inspection_Frequency]![Dwnhole_ID]));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top