Link to home
Start Free TrialLog in
Avatar of ChuckRush
ChuckRush

asked on

Set LocalConnection = CurrentProject.AccessConnection syntax for Access 2000

I have developed an application in Access 2002 the uses the following systax.

Dim LocalConnection As ADODB.Connection
Set LocalConnection = CurrentProject.AccessConnection


I now find I have to include some PCs running v 2000. Can you tell me what the correct sytax is. The syntax above is not supported in ADO 2.1 ot extentions 2.7 which are included on the PcS.

Alternatively, can I load the more current version of the libraries and if so where do i get them.

Thanks
Avatar of flavo
flavo
Flag of Australia image

Avatar of ChuckRush
ChuckRush

ASKER

OK so there is another problem. The OS is XP sp1 and v2.8 does not install. I user v2.7 sp1 but it does not seem to support the syntax either.
>> The OS is XP sp1 and v2.8 does not install

I don't recall that happening... Do you have the rights to install (Admin rights?)

Can you post your full code please.

Dave
Private Sub PrintWholeRecord_Click()
On Error GoTo Err_PrintWholeRecord_Click

Dim stDocName As String
'Check Report Print Flag
Dim rsHR As New ADODB.Recordset
Dim strSQL As String
Dim strWork As String
Dim LocalConnection As ADODB.Connection
Set LocalConnection = CurrentProject.AccessConnection
rsHR.CursorType = adOpenDynamic
rsHR.LockType = adLockOptimistic
strSQL = "Select * from StatusTable"
rsHR.Open strSQL, LocalConnection, , , adcmdtxt
rsHR.Find "ID = " & Str(1)
rsHR("HR ID") = Me.ID
rsHR.Update
rsHR.Close
Set rsHR = Nothing
    stDocName = "Screen Print"
    DoCmd.OpenReport stDocName, acPreview
Err_PrintWholeRecord_Click:
    MsgBox Err.Description
    Resume Exit_PrintWholeRecord_Click
End Sub
Can't see why this wont work

Private Sub PrintWholeRecord_Click()
On Error GoTo Err_PrintWholeRecord_Click

Dim stDocName As String
'Check Report Print Flag
Dim rsHR As New ADODB.Recordset
Dim strSQL As String
Dim strWork As String
rsHR.CursorType = adOpenDynamic
rsHR.LockType = adLockOptimistic
strSQL = "Select * from StatusTable"
rsHR.Open strSQL, CurrentProject.AccessConnection, , , adcmdtxt
rsHR.Find "ID = " & Str(1)
rsHR("HR ID") = Me.ID
rsHR.Update
rsHR.Close
Set rsHR = Nothing
    stDocName = "Screen Print"
    DoCmd.OpenReport stDocName, acPreview
Err_PrintWholeRecord_Click:
    MsgBox Err.Description
    Resume Exit_PrintWholeRecord_Click
End Sub
I works great under xp sp2 and 2.8 ado but it reports that property is not supported uner xp sp1 and 2.7
I only have Access 97 at work, but I'm sure this

CurrentProject.AccessConnection

should be either

CurrentProject.Connection

or

CurrentProject.ActiveConnection

Can't recall from memory sorry..

Dave

Is there a procitcal reason why you are not using the

CurrentProject.Connection object?

I have ADO 2.8, and find no reference to CurrentProject.ActiveConnection

AW
ASKER CERTIFIED SOLUTION
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial