passing parameters to query from form (1 Viewer)

MilaK

Registered User.
Local time
Yesterday, 20:22
Joined
Feb 9, 2015
Messages
285
Hello,

I’m trying to pass a parameter (one of the query fields) from a form to a query but I get an error that item is not found in the collection, however, that field exists in the query (see SQL below). What is wrong?

Query SQL:

Code:
SELECT tbl_Projects.run_type, [B]tbl_Projects.run_name[/B], row_source_all_variants.*, freq_variants_intermidiate.Exp, count_of_samples_for_tumor_type.Exp, [freq_variants_intermidiate].Exp & "/" & [count_of_samples_for_tumor_type].Exp AS finalfreq, count_of_aa_change.Exp, count_of_samples.Exp, [count_of_aa_change].[Exp] & "/" & [count_of_samples].[exp] AS totalfreq INTO tbl_Variant_query
FROM ((((row_source_all_variants LEFT JOIN freq_variants_intermidiate ON (row_source_all_variants.aa_change = freq_variants_intermidiate.aa_change) AND (row_source_all_variants.tumor_type = freq_variants_intermidiate.tumor_type)) LEFT JOIN count_of_samples_for_tumor_type ON row_source_all_variants.tumor_type = count_of_samples_for_tumor_type.tumor_type) INNER JOIN tbl_Projects ON row_source_all_variants.run_name = tbl_Projects.run_name) LEFT JOIN count_of_aa_change ON row_source_all_variants.aa_change = count_of_aa_change.aa_change) LEFT JOIN count_of_samples ON tbl_Projects.run_type = count_of_samples.run_type;

Continuous form button code: I get an error that item is not found in the collection.

Code:
Private Sub cmb_review_one_Click()

Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("make_a_table_variants")
Debug.Print Me.run_name
'qdf.Parameters("run_name").Value = Me.run_name
[B]qdf!run_name = Me.run_name[/B]
qdf.Execute
qdf.Close

Set qdf = Nothing
Set dbs = Nothing

End Sub
 

MilaK

Registered User.
Local time
Yesterday, 20:22
Joined
Feb 9, 2015
Messages
285
I figured this one out! I had to create a parameter in the query. Thanks, Mila
 

Users who are viewing this thread

Top Bottom