ms access 2003 form/subform

By bernie ·
Dear All

I am trying to have dynamic subforms whereby the variables for the relevant subforms are dynamically assigned by the program.

Would anyone know how to go about this?

All efforts like me!sub.controls = "f_customer_details1" etc. failed.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

sample forms

by sgt_shultz In reply to ms access 2003 form/subfo ...

are you able to download the sample access forms from

HIH you get started.

Collapse -

form / subform

by bernie In reply to sample forms

I managed to type a function call with variable form names like this:

call from form/procedure:

Dim strMainform As String
Dim strSubformControlName As String
Dim strControlName As String

strMainform = "f_trip_header"
strSubformControlName = "varform"
strControlName = "f_trip_details"

Forms(strMainform)(strSubformControlName).Visible = True

Call variableform(strMainform, strSubformControlName, strControlName)
Forms(strMainform)(strSubformControlName).LinkMasterFields = "Counter"
Forms(strMainform)(strSubformControlName).LinkChildFields = "parentlink"

actual function in module1/formutilites:

Public Function variableform(strMainform As String, strSubformControlName As String, strControlName As String)

'mainform: form1
'subform: subform
'sourceobject: f_customer

MsgBox (strMainform & " " & strSubformControlName & " " & strControlName)

Forms(strMainform)(strSubformControlName).SourceObject = (strControlName)

This was a tough one and I hope some folks can benefit from this little function that dynamically allows you open subforms.

Related Discussions

Related Forums