how to create checkboxes on form-load?? (VERY URGENT)
how to create checkboxes on form-load?? (VERY URGENT)
(OP)
Hi there, it's me again... frag!
I have another problem!
I want to create some checkboxes (corresponding to a database field) on form-load for a form i have created in design-view.
Here is my code...
------------------------------------------------------------
Private Sub Form_Load()
Dim ctlCheckbox As Control
Set ctlCheckbox = CreateControl(Form.Name, acCheckBox,
acDetail, "", "", 100, 100)
End Sub
------------------------------------------------------------
I keep getting this error-msg:
Run-time error '2147':
You must be in Design view to create or delete views.
What's wrong?
thanx.
frag
I have another problem!
I want to create some checkboxes (corresponding to a database field) on form-load for a form i have created in design-view.
Here is my code...
------------------------------------------------------------
Private Sub Form_Load()
Dim ctlCheckbox As Control
Set ctlCheckbox = CreateControl(Form.Name, acCheckBox,
acDetail, "", "", 100, 100)
End Sub
------------------------------------------------------------
I keep getting this error-msg:
Run-time error '2147':
You must be in Design view to create or delete views.
What's wrong?
thanx.
frag
RE: how to create checkboxes on form-load?? (VERY URGENT)
there is something i forgot:
i am using VBA for Access 97
:)
RE: how to create checkboxes on form-load?? (VERY URGENT)
Public Sub MakeCtls()
DoCmd.OpenForm "form1", acDesign, , , , acHidden
CreateControl "form1", acTextBox, acDetail, , 15, 15, 15, 1500, 500
DoCmd.OpenForm "form1"
End Sub
Durkin
alandurkin@bigpond.com
RE: how to create checkboxes on form-load?? (VERY URGENT)
Thanx for your reply.
I have checked out your piece of code... but this doesn't work either.
Run-time error '2174':
You can't switch to a diffrent view at this time.
Code was executing when you tried to switch views.
If you are debugging code, you must end the debugging operation before switching views.
I will just set my checkboxes to invisble and set them to visible at runtime when i need them. Ugly, but it works.
Thanx!
frag
patrick.metz@epost.de
RE: how to create checkboxes on form-load?? (VERY URGENT)
RE: how to create checkboxes on form-load?? (VERY URGENT)
Thanx for your reply.
1. visible/invisible
--------------------
I already mentioned this in my last replay!
2. Why I need to create controls on formload
-------------------------------------------
I get data from a database table. According to this data
I have to set controls to visible/unvisible. Thought it
would be nicer to have a dynamic form with dynamic
controls (for saving place on the desktop).
But anyway... forget it. The app is finish and rolled out.
cya
frag
patrick.metz@epost.de