Adding custom fields to dynamically created controls.

L

leiarose

I created a custom Outlook (2003) form that imports data from Access to
populate user defined fields and create additional controls based on
the number of records in an Access query. Everything works fine except
the data the user enters for the dynamically created controls don't
hold their value when the form is sent. I am quessing that is because
there is no user defined fields bound to them. (how do I do this) I
have been looking on the net but cannot find anything close enough. Any
help (examples) would be appreciated.
 
L

leiarose

I have been all thru there. It is still not working. Here is a piece of
the code that adds the controls if you have any suggestions. Thanks in
advance.


ctrlcount = 0
Do While counter <> recCount
Set Mycmd = Page.Add("Forms.Textbox.1")'name
appRec = "appRec" & ctrlcount
MyCmd.Tag = rst4.Fields(1)
Mycmd.Font.Bold = True
Mycmd.Left = 16
Mycmd.Top = y
Mycmd.Width = 154
Mycmd.Height = 20
Mycmd.Font.Size = 10
Mycmd.Value = rst4.Fields(0)
Mycmd.BackStyle = 0
Mycmd.SpecialEffect = Flat
Mycmd.Locked = True
Set appProp = Iup.Add(appRec, 1)' add field
Iup.Find("appRec").ItemProperty = Mycmd.Tag
Mycmd.ItemProperty = appProp
Set Mycmd = Page.Add("Forms.Checkbox.1")' to visit
ctrlcount = ctrlcount + 1
appRec = "appRec" & ctrlcount
Mycmd.Tag = rst4.Fields(1)
Mycmd.Left = 180
Mycmd.Top = y
Mycmd.Width = 17
Mycmd.Height = 20
Set appProp = Iup.Add(appRec, 6)' add field
Mycmd.ItemProperty = appProp
'there are more controls I took out
loop
 
K

Ken Slovak - [MVP - Outlook]

Don't add controls using code. It one-offs the form. Design the custom form
and add the controls at design time and bind them to the user properties
then. I didn't notice before that you had specified dynamically created
controls, it's such a bad idea I didn't even consider that's what you wanted
to do.
 
L

leiarose

Thanks for responding, sorry about the delay. I don't know how many
controls I will need at design time and they only want the 1 row of
controls per record from the database. I could't figure it any other
way.
 

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