|
-
Dec 6th, 2002, 09:37 AM
#1
Thread Starter
Fanatic Member
object variable ......Not set error
I don know whats going on.. I kinda figured i cannot do this..
but it looks alright..
What am i doing wrong?
VB Code:
Private dbsBlastRoom As Database
Private rstDustCollector As Recordset 'DustCollector
Private rstFan As Recordset 'DCFans
Private rstHp As Recordset 'DCMotor
Private Function CalcPurchParts(dec As tDustCollector)
'ALREADY SET dB VAR
CalcPurchParts = Recordset("DCFans", rstFan, mDustCollector.Description.m_FanSize)(2) + _
Recordset("DCMotor", rstHp, mDustCollector.Description.m_FanHp)(2) 'ERROR ON THIS LINE
End Function
Private Function Recordset(Table As String, rstVariable As Recordset, itemSeek As Long) As Recordset
Set rstVariable = dbsBlastRoom.OpenRecordset(Table)
rstVariable.MoveFirst
rstVariable.Index = "PrimaryKey"
rstVariable.Seek "=", itemSeek
rstVariable.Close
End Function
Thanks
Seahag
====================
-
Dec 6th, 2002, 09:43 AM
#2
The function Recordset doesn't return anything
-
Dec 6th, 2002, 09:43 AM
#3
Let me in ..
Well, you did not create the instances for your recordsets.
Private rstDustCollector As Recordset 'DustCollector
Private rstFan As Recordset 'DCFans
Private rstHp As Recordset 'DCMotor
Shouldn't this be
Private rstDustCollector As new Recordset 'DustCollector
Private rstFan As new Recordset 'DCFans
Private rstHp As new Recordset 'DCMotor
-
Dec 6th, 2002, 09:52 AM
#4
Thread Starter
Fanatic Member
Originally posted by axion_sa
The function Recordset doesn't return anything
Ok.. i have revised .....
VB Code:
Private Function Recordset(Table As String, rstVariable As Recordset, itemSeek As Long) As Recordset
Set rstVariable = dbsBlastRoom.OpenRecordset(Table)
rstVariable.MoveFirst
rstVariable.Index = "PrimaryKey"
rstVariable.Seek "=", itemSeek
Recordset = rstVariable
rstVariable.Close
End Function
But now its a invalid use of property??
As well... techyspecy.. i cant do that because i get.. Invalid use of New Keyword
Seahag
-
Dec 6th, 2002, 09:54 AM
#5
-
Dec 6th, 2002, 09:56 AM
#6
Thread Starter
Fanatic Member
Originally posted by kleinma
you are using DAO 3.6?
yes
-
Dec 6th, 2002, 09:57 AM
#7
Originally posted by SeaHag
Ok.. i have revised .....
VB Code:
Private Function Recordset(Table As String, rstVariable As Recordset, itemSeek As Long) As Recordset
Set rstVariable = dbsBlastRoom.OpenRecordset(Table)
rstVariable.MoveFirst
rstVariable.Index = "PrimaryKey"
rstVariable.Seek "=", itemSeek
Set Recordset = rstVariable ' *** Must use the Set keyword
rstVariable.Close ' *** This will close the return aswell.
End Function
-
Dec 6th, 2002, 10:04 AM
#8
Thread Starter
Fanatic Member
Thank you..
What started out as saving some code... ended up turning in to
variable all over the place.. Argg...
Whats an efficient way of automating a
recordset connection ?
Seahag
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
|