Mike Leigh
Registered User.
- Local time
- Today, 00:56
- Joined
- Feb 5, 2001
- Messages
- 11
Hi,
This must be really simple to do. I am trying to run an insert into from vba while taking the values from a form.
DoCmd.RunSQL "INSERT INTO company_categories (company_name_id,category_name_id) SELECT '2','3'", -1
The above code works however the text 2 and 3 I have to place manually in here because I do not remember how to place them in a variable. Please help
e.g.
Dim test2 as string
The code now reads for me
Dim test2 as string
test2 = 4
DoCmd.RunSQL "INSERT INTO company_categories (company_name_id,category_name_id) SELECT test2,'3'", -1
This gives me a message box asking what value test2 should be and I have allready set test2 to be 4 in the above.
Thanks in advance
This must be really simple to do. I am trying to run an insert into from vba while taking the values from a form.
DoCmd.RunSQL "INSERT INTO company_categories (company_name_id,category_name_id) SELECT '2','3'", -1
The above code works however the text 2 and 3 I have to place manually in here because I do not remember how to place them in a variable. Please help
e.g.
Dim test2 as string
The code now reads for me
Dim test2 as string
test2 = 4
DoCmd.RunSQL "INSERT INTO company_categories (company_name_id,category_name_id) SELECT test2,'3'", -1
This gives me a message box asking what value test2 should be and I have allready set test2 to be 4 in the above.
Thanks in advance