I have an unbound form that contains 2 dropdown boxes and a sub form. Upon selecting a value from one of them, the subform dutifully displays associated data from the value. Name and ID for now.
What I would like is (once the user selects an id and clicks a button) for the data in the subform to be appended to a table. Here's the code I have so far (and I just included the ID for now to test it)..
the table is tbl_req_tmp_A999999090211131727. The subform is named frm_sub_mars_data and the textbox I am testing is nameed txt_Assoc_ID.
When I run it as it stands below, I get an error saying it can't find the form..
How do I refer to the subform and its fields so I can set variables to them (and append to the destination table using the variables in my SQL)?
Thanks for any assistance!
Dim d As Database
Dim str_sql As String
Dim str_fld01 As String
Dim str_fld02 As String
Set d = CurrentDb
str_fld01 = Forms!frm_sub_mars_data!txt_Assoc_ID
str_sql = "insert into tbl_req_tmp_A999999090211131727 (assoc_id) values (" & str_fld01
d.Execute str_sql
d.Close
What I would like is (once the user selects an id and clicks a button) for the data in the subform to be appended to a table. Here's the code I have so far (and I just included the ID for now to test it)..
the table is tbl_req_tmp_A999999090211131727. The subform is named frm_sub_mars_data and the textbox I am testing is nameed txt_Assoc_ID.
When I run it as it stands below, I get an error saying it can't find the form..
How do I refer to the subform and its fields so I can set variables to them (and append to the destination table using the variables in my SQL)?
Thanks for any assistance!
Dim d As Database
Dim str_sql As String
Dim str_fld01 As String
Dim str_fld02 As String
Set d = CurrentDb
str_fld01 = Forms!frm_sub_mars_data!txt_Assoc_ID
str_sql = "insert into tbl_req_tmp_A999999090211131727 (assoc_id) values (" & str_fld01
d.Execute str_sql
d.Close