|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBA - connection to server fails - "object is required".
I have an access adp and SQL Server 2000.
I have used code similar to the below many times to make a connection to the server and run a stored procedure. But this time it is telling me that an object is required and blowing up at the .ActiveConnection line. Can anyone help me figure this one out? Thanks! Code:
Dim intClaimID As Integer
Dim intPersonID As Integer
Dim intPersonTypeID As Integer
intClaimID = Form_frmClaims.txtClaimID
intPersonID = Me.listPeople.Column(0)
intPersonTypeID = 3
With cmd
.ActiveConnection = CurrentProject.BaseConnectionString
.CommandType = adCmdStoredProc
.CommandText = "CSF_UPDATE_Claim_Person_XREF_T"
.Parameters.Refresh
.Parameters(1) = 0 'Need to autoset the Claim_Person_XREF_ID
.Parameters(2) = intClaimID
.Parameters(3) = intPersonID
.Parameters(4) = intPersonTypeID
.Parameters(5) = 0 'Deleted_B set to zero
Set rst = .Execute
End With
|
|
#2
|
|||
|
|||
|
Where do you ever create the cmd object?
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Gee - don't I feel dumb.
![]() It always helps to actually declare your variables! Thanks for pointing it out. I had just stared at it for so long that I totally missed the obvious. |
|
#4
|
|||
|
|||
|
I like to use Option Explicit at the top of pages. That way the interpreter alerts you to undeclared variables, mis-spelled variable names and other programming annoyances.
![]() |
|
#5
|
|||
|
|||
|
Thanks for the advice - I didn't know that's what that "Option Explicit" was for. That will help me quite a bit, I think.
|
|
#6
|
|||
|
|||
|
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > VBA - connection to server fails - "object is required". |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|