creating a form from code

G

Guest

I am trying to create a form that will polpualte itself with a number of checkboxes based on the number of differing values in a table. I succeeded in building the form using createcontrol() to add the checkboxes, labels, and the command button that closes the form. I used createeventproc() and insertlines() to add the code that that command button executes. This also worked. The form was created and executed exactly how I wanted it to work. Then I saved the DB as an MDE file. I received the error message "That command isn't available in an MDE/ADE database." I assume because I am trying to edit a module. I tried saving the form with only the command button and it's event procudure and using that as the createform() template. But neither the control or code come over when the form is created and I get an error that it is missing. I am looking for a way to dynamically create a form with an unknown number of controls, and one control(command button) that needs to be moved accordingly, but that will always be there and execute the same code. Suggestions?
 
V

Van T. Dinh

In MDE, you cannot change the *design* of the database so I don't think the
method will work in MDE.

Suggest you create the Form with as many Controls as you need (there is a
limit of 700+ Controls) + the CommandButton + code. In the execution of the
Form, you can hide the unused Controls.

--
HTH
Van T. Dinh
MVP (Access)




Michael said:
I am trying to create a form that will polpualte itself with a number
of checkboxes based on the number of differing values in a table. I
succeeded in building the form using createcontrol() to add the checkboxes,
labels, and the command button that closes the form. I used
createeventproc() and insertlines() to add the code that that command button
executes. This also worked. The form was created and executed exactly how
I wanted it to work. Then I saved the DB as an MDE file. I received the
error message "That command isn't available in an MDE/ADE database." I
assume because I am trying to edit a module. I tried saving the form with
only the command button and it's event procudure and using that as the
createform() template. But neither the control or code come over when the
form is created and I get an error that it is missing. I am looking for a
way to dynamically create a form with an unknown number of controls, and one
control(command button) that needs to be moved accordingly, but that will
always be there and execute the same code. Suggestions?
 

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