Hi Jerry Bodoff
There's no mis-understanding. Jezebel's absolutely correct. You can't use:
form2.show arg1 arg2 arg3
or
form2.load arg1 arg2 arg3
Neither accept arguments and the second syntax is invalid.
You have to use Properties or Methods in your Form. If you want to read/write values then
uses Properties if you just want to pass in a whole bunch of information use a Method (a
Public Sub declared within your Form). This is the correct object oriented approach to
the problem.
Here's an example of both properties and a method in action, this code is part of the
Form:
Private mdateFirst As Date
Private mdateLast As Date
Private mstrTitle As String
Private mstrFirstName As String
Private mstrMiddleName As String
Private mstrLastName As String
Public Property Get FirstDate() As Date
FirstDate = mdateFirst
End Property
Public Property Let FirstDate(ByVal FirstDate As Date)
mdateFirst = FirstDate
End Property
Public Property Get LastDate() As Date
LastDate = mdateLast
End Property
Public Property Let LastDate(ByVal LastDate As Date)
mdateLast = LastDate
End Property
Public Sub NameInfo(ByVal Title As String, _
ByVal FirstName As String, _
ByVal MiddleName As String, _
ByVal LastName As String)
mstrTitle = Title
mstrFirstName = FirstName
mstrMiddleName = MiddleName
mstrLastName = LastName
End Sub
You would instantiate the form and set the properties like this:
Public Sub ShowFormTheTechnicallyCorrectWay()
Dim frmT As frmTest
Set frmT = New frmTest
Load frmT
frmT.FirstDate = "1/1/04"
frmT.LastDate = "31/12/04"
frmT.NameInfo "Mr", "Joe", "Blow", "Doe"
frmT.Show
MsgBox "Form complete"
Unload frmT
Set frmT = Nothing
End Sub
HTH + Cheers - Peter
as neither