J
James
I'm stuck and I need some help... I'm an intern trying to help update
some code... Here's what I've got: A form that on load, updates some a
field (ReleaseName) to "Production" if the release date has passed...
Anyways, they've got it set up where it's going through all these class
modules and i've never delt with them before... Anyways, I keep getting
a compile error (invalid use of property) at : dataHolder.Dataset in
the load data... any ideas from what I've given you as to how to fix
it? Thanks
Here's My Forms On Load Code:
Option Compare Database
Dim fm As New FormManager
Dim dataHolder As DataSource
'Data source name
Private m_sourceData As String
------------------------------
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim strDate As String
Dim ReleaseName As String
Dim varItm As Variant
Dim rs As ADODB.Recordset
Dim Display As Integer
strDate = Format(Date, "yyyy/mm/dd")
Dim Store As Variant
m_sourceData = "UpdateToProduction"
LoadData
dataHolder.Dataset
Do While Not dataHolder.Dataset.EOF
If dataHolder.Dataset.Fields("ReleaseName") <> "Production"
Then
If dataHolder.Dataset.Fields("ReleaseName") < strDate
Then
dataHolder.Dataset.Fields("ReleaseName") =
"Production"
End If
End If
dataHolder.Dataset.MoveNext
Loop
If Not dataHolder.UpdateData Then
Display = MsgBox("Update Failed", vbOKOnly, "Database Update")
Else
Display = MsgBox("All Release dates prior to " & strDate & " are now
listed under 'Production'.", vbOKOnly, "Database Update")
End If
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
--------------------------
Private Sub LoadData(Optional searchParams As Variant)
Set dataHolder = Nothing
If Not IsMissing(searchParams) Then
If IsEmpty(searchParams) Then
Set dataHolder = fm.GetFormData(m_sourceData, True)
Else
Set dataHolder = fm.GetFormData(m_sourceData, True,
searchParams)
End If
Else
Set dataHolder = fm.GetFormData(m_sourceData, True)
End If
End Sub
+++++++++++++++++++++++++++++++++++++++++++++++
Class Module: DataSource_Jet
+++++++++++++++++++++++++++++++++++++++++++++++
'DataSource for Microsoft Jet databases
Option Compare Database
Private m_conn As ADODB.Connection
Private m_rst As ADODB.Recordset
Private m_fieldCount As Integer
Private m_initialized As Boolean
Private m_isUpdateable As Boolean
Private m_isEmpty As Boolean
Private m_isDirty As Boolean
Private m_recCount As Long
Private m_isError As Boolean
Private m_errorMessage As String
Private m_identity As Long
Implements DataSource
--------------------------------------
Public Property Get DataSource_Dataset() As ADODB.Recordset
If m_isEmpty Or Not m_initialized Then
Exit Property
End If
Set DataSource_Dataset = m_rst
End Property
-------------------------------------------
some code... Here's what I've got: A form that on load, updates some a
field (ReleaseName) to "Production" if the release date has passed...
Anyways, they've got it set up where it's going through all these class
modules and i've never delt with them before... Anyways, I keep getting
a compile error (invalid use of property) at : dataHolder.Dataset in
the load data... any ideas from what I've given you as to how to fix
it? Thanks
Here's My Forms On Load Code:
Option Compare Database
Dim fm As New FormManager
Dim dataHolder As DataSource
'Data source name
Private m_sourceData As String
------------------------------
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim strDate As String
Dim ReleaseName As String
Dim varItm As Variant
Dim rs As ADODB.Recordset
Dim Display As Integer
strDate = Format(Date, "yyyy/mm/dd")
Dim Store As Variant
m_sourceData = "UpdateToProduction"
LoadData
dataHolder.Dataset
Do While Not dataHolder.Dataset.EOF
If dataHolder.Dataset.Fields("ReleaseName") <> "Production"
Then
If dataHolder.Dataset.Fields("ReleaseName") < strDate
Then
dataHolder.Dataset.Fields("ReleaseName") =
"Production"
End If
End If
dataHolder.Dataset.MoveNext
Loop
If Not dataHolder.UpdateData Then
Display = MsgBox("Update Failed", vbOKOnly, "Database Update")
Else
Display = MsgBox("All Release dates prior to " & strDate & " are now
listed under 'Production'.", vbOKOnly, "Database Update")
End If
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
--------------------------
Private Sub LoadData(Optional searchParams As Variant)
Set dataHolder = Nothing
If Not IsMissing(searchParams) Then
If IsEmpty(searchParams) Then
Set dataHolder = fm.GetFormData(m_sourceData, True)
Else
Set dataHolder = fm.GetFormData(m_sourceData, True,
searchParams)
End If
Else
Set dataHolder = fm.GetFormData(m_sourceData, True)
End If
End Sub
+++++++++++++++++++++++++++++++++++++++++++++++
Class Module: DataSource_Jet
+++++++++++++++++++++++++++++++++++++++++++++++
'DataSource for Microsoft Jet databases
Option Compare Database
Private m_conn As ADODB.Connection
Private m_rst As ADODB.Recordset
Private m_fieldCount As Integer
Private m_initialized As Boolean
Private m_isUpdateable As Boolean
Private m_isEmpty As Boolean
Private m_isDirty As Boolean
Private m_recCount As Long
Private m_isError As Boolean
Private m_errorMessage As String
Private m_identity As Long
Implements DataSource
--------------------------------------
Public Property Get DataSource_Dataset() As ADODB.Recordset
If m_isEmpty Or Not m_initialized Then
Exit Property
End If
Set DataSource_Dataset = m_rst
End Property
-------------------------------------------