|
-
Feb 13th, 2001, 03:40 AM
#1
Thread Starter
Member
Hi, I'm passing a recordset to a usercontrol, and i like the usercontrol to have a recordset property. But I can't do it. It is not valid.
---------------------
at form:
set db = dbengine.opendatabase (...)
set rs = db.openrecordset("anything")
usercontrol.RS = rs
-----------------------
at usercontrol:
public property get/let(byval m_rs as recordset)
.....
end property
-----------------------
the above won't work. Anyone know alternative to this, do i need to use DataMembers instead?
It take a baby step for you to be here, nothing is impossible.
v(^o^)v
-
Feb 13th, 2001, 03:51 AM
#2
Fanatic Member
What you need
You need a property SET instead of a property LET for a start.
You didn't mention how it failed? What was the error?
-
Feb 13th, 2001, 04:25 AM
#3
Thread Starter
Member
compilation error
"Invalid use of property" at UserControl_ReadProperties
Dim m_totalRS As Recordset
Public Property Get totalRS() As Recordset
totalRS = m_totalRS
End Property
Public Property Set totalRS(ByVal New_totalRS As Recordset)
m_totalRS = New_totalRS
PropertyChanged "totalRS"
End Property
'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
m_totalRS = m_def_totalRS
End Sub
'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
m_totalRS = PropBag.ReadProperty("totalRS", m_def_totalRS)
End Sub
'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("totalRS", m_totalRS, m_def_totalRS)
End Sub
It take a baby step for you to be here, nothing is impossible.
v(^o^)v
-
Feb 13th, 2001, 05:08 AM
#4
Fanatic Member
Try
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
SET m_totalRS = PropBag.ReadProperty("totalRS", m_def_totalRS)
End Sub
N.B. Note the addition of the keywork SET before assigning to the recordset object.
-
Feb 13th, 2001, 08:15 PM
#5
Thread Starter
Member
new error
Object required at your recommended statement.
It take a baby step for you to be here, nothing is impossible.
v(^o^)v
-
Feb 14th, 2001, 03:52 AM
#6
Fanatic Member
Suggestion
You must make sure 'm_def_totalRS' has been instantiated before UserControl_ReadProperties is called.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|