VBA runtime error 2424 - checkboxes checked but not exporting to excel

Summer123

Registered User.
Local time
Today, 18:03
Joined
Feb 9, 2011
Messages
216
Hi,
i basically have a combobox that when selected checks all the check boxes that are applicable for that customer. Now the checked boxes i want to export these out in excel. it was working fine previously when the checkboxes were not bound, but now that they are bound its not working.. and am getting an error "ms access the expression you entered has a field, control or property name that DB cant find"

i have a customer table with customerID and Customer name
the combobox basically show customer name

the form also has about 10 checkboxes (name is where i have written the append query names, so that when its checked it runs that append query), when the customer name is selected in the combobox, it checks off the certain boxes that are applicable to that customer, it then basically runs some append queries for these checked check boxes and generates another table "tbledits" that i then want to export out to an excel.

so here is the code for the export that i was using


PLEASE HELP!!! thanks Summer
 
Last edited:
Have you declared and set the MyForm variable?
 
not sure waht you mean, do you mean the record source of the form?
 
No, "MyForm" has no meaning to Access unless you've specifically given it one. See if this works, presuming the code is within the form with the check boxes:

For Each ctl In Me.Controls

Your alternative is this type of thing:

Dim MyForm As Form
Set MyForm = (insert an appropriate reference to the desired form here)
For Each ctl In MyForm.Controls
 
i do have that..
Dim db As DAO.Database
Set db = CurrentDb
Dim rst As DAO.Recordset
Dim MyForm As Form
Set MyForm = Forms!edit_selection
Dim fileIn As String
Dim intCountofSheets, intCurrentSheet As Integer
Dim strFileName As String
 
do you think the ctl would only work with unbound checkboxes and not bound checkboxes?
 
If the error is on that line, it hasn't gotten to that point yet, but it should work with either. Do you have this line?

Dim ctl As Control
 
i didnt have that and added that but still the same error at the same point
 
Can you post the db here, or a representative sample?
 
i actually got it to work... i had to basically add all the controls in the table ... i just thought maybe i can try few and then see if it runs.. but i should have known...went brain dead for few hours there :) thanks for your help though!!!
 
Glad you got it sorted out.
 

Users who are viewing this thread

Back
Top Bottom