HOW DO I?: Arrays - Assigning

Randomblink

The Irreverent Reverend
Local time
Today, 15:49
Joined
Jul 23, 2001
Messages
279
Question:

If I create a usertype:

Public Type boObject
frmAction As String
frmForm(1 To 3) As Form
tblTable(1 To 3) As String
tblField(1 To 2) As String
frmField(1 To 2) As Control
End Type

And I want to assign: FrmXYZ and FrmABC to the frmForm element, how would I do this?

Would it be:
Set frmForm(0) = FrmXYZ
Set frmForm(1) = FrmABC

Or would it be something else...?
 
Public Type TMyStruct
Action As String
Form(1 To 3) As Form
TableName(1 To 3) As String
FieldName(1 To 2) As String
Field(1 To 2) As Control
End Type

Public udtExample As TMyStruct

....

Set udtExample.Form(1) = FrmXYZ
 
Doh!

Yeah...sorry ritch...

What I meant to ask was:

How would I call a function using two forms for the boObject?
------------------------------------------------------
Public Function test(test as boObject)
DoCmd.Open test.frmForm(1)
DoCmd.Close test.frmForm(2)
End Function
------------------------------------------------------
Call test???????

How would I call using frmXYZ as the first one and frmABC as the second?

That is what I meant to ask...thanks...
 
Sorry to jump in here. I prefer to use my way below.

Function Test(intItem As Integer)
Dim varItems As Variant, My As String
varItems = Array("FrmXYZ", "FrmABC", "FrmXXX")
My = varItems(intItem)
Test = My
End Function


Sub OpenForm()
DoCmd.OpenForm Test(0)
DoCmd.OpenForm Test(1)
DoCmd.OpenForm Test(2)
End Sub
 
This should do it

Call test(udtExample)

or just...

test udtExample
 

Users who are viewing this thread

Back
Top Bottom