J
James
I keep getting an "object variable or with block variable not set"
error with this code....
I want to use the loadData function twice, to get two different sets of
data, so I figured I could use two DataSource objects and put an
argument in the loadData Function to set which DataSource I'm using,
but when I do it that way I keep getting that error.. Below are my
variable declarations code and the loadData function...
Option Compare Database
Public Const AMPERSAND = "&"
Public Const TAB_SPACE = " "
'Form data source
Dim OfferingData As DataSource
Dim RuleData As DataSource
Dim formData As DataSource
Dim fm As New FormManager
'Data source name
Private m_sourceData As String
'Search value
Private m_searchValue As Variant
-------------------------------------
Public Function writeOfferingsXML()
' Declare object variables.
Dim rs As ADODB.Recordset
Dim rl As ADODB.Recordset
Dim sql, outfile, dbfile As String
Dim OfferingName, offeringUrl, OfferingCategory, OfferingSubCategory,
OfferingGroup, _
offeringPos, offeringRight, ToolTip, _
offeringContext, offeringVerify, offeringCriteria As String
Dim toolIdUrl, contextTag, HotKey As String
Dim semicolonPos, lastPos As Integer
Dim done As Boolean
Dim offeringID As String
'Return reference to current database.
m_sourceData = "Offerings_Display"
LoadData (OfferingData)
Set rs = OfferingData.Dataset
..... some more code here, i can copy paste it if you need me to, but it
doesn't really apply to the problem....
End Function
-----------------------------------------
Private Sub LoadData(dataHolder As DataSource, Optional searchParams As
Variant)
Set dataHolder = Nothing
If Not IsMissing(searchParams) Then
If IsEmpty(searchParams) Then
Set dataHolder = fm.GetFormData(m_sourceData, False)
Else
Set dataHolder = fm.GetFormData(m_sourceData, False,
searchParams)
End If
Else
dataHolder = fm.GetFormData(m_sourceData, False)
End If
End Sub
it runs just fine If i get rid of the dataHolder argument and just pass
one variable (dataHolder) through the function.... but I need it to be
used again to get another set of data at the same time... I'm just an
intern if you can't tell thanks.
error with this code....
I want to use the loadData function twice, to get two different sets of
data, so I figured I could use two DataSource objects and put an
argument in the loadData Function to set which DataSource I'm using,
but when I do it that way I keep getting that error.. Below are my
variable declarations code and the loadData function...
Option Compare Database
Public Const AMPERSAND = "&"
Public Const TAB_SPACE = " "
'Form data source
Dim OfferingData As DataSource
Dim RuleData As DataSource
Dim formData As DataSource
Dim fm As New FormManager
'Data source name
Private m_sourceData As String
'Search value
Private m_searchValue As Variant
-------------------------------------
Public Function writeOfferingsXML()
' Declare object variables.
Dim rs As ADODB.Recordset
Dim rl As ADODB.Recordset
Dim sql, outfile, dbfile As String
Dim OfferingName, offeringUrl, OfferingCategory, OfferingSubCategory,
OfferingGroup, _
offeringPos, offeringRight, ToolTip, _
offeringContext, offeringVerify, offeringCriteria As String
Dim toolIdUrl, contextTag, HotKey As String
Dim semicolonPos, lastPos As Integer
Dim done As Boolean
Dim offeringID As String
'Return reference to current database.
m_sourceData = "Offerings_Display"
LoadData (OfferingData)
Set rs = OfferingData.Dataset
..... some more code here, i can copy paste it if you need me to, but it
doesn't really apply to the problem....
End Function
-----------------------------------------
Private Sub LoadData(dataHolder As DataSource, Optional searchParams As
Variant)
Set dataHolder = Nothing
If Not IsMissing(searchParams) Then
If IsEmpty(searchParams) Then
Set dataHolder = fm.GetFormData(m_sourceData, False)
Else
Set dataHolder = fm.GetFormData(m_sourceData, False,
searchParams)
End If
Else
dataHolder = fm.GetFormData(m_sourceData, False)
End If
End Sub
it runs just fine If i get rid of the dataHolder argument and just pass
one variable (dataHolder) through the function.... but I need it to be
used again to get another set of data at the same time... I'm just an
intern if you can't tell thanks.