J
Joop
In the past 2 years I developed an application that by now is growing a bit
big, several tables of over 500.000 records and a lot of smaller ones.
So I decided to migrate to MS SQL Server.
I imported the tables in SQL server, deleted all tables in Access and
created linked tables in Access.
In every procedure where I use ADODB in my code I get errors.
I tried different connection strings to connect to the SQL Servers tables
straight away. I also tried to connect using the same DSN I used to link the
tables.
Who can help me to determine the right connection string? (or another
solution)
A sample of the code where it goes wrong, the first open (line 13) runs ok
but it does not execute line 24 so probably I have permission to read but
not to delete or write?
1 Private Sub CmdBereken_Click()
2 Dim cn As ADODB.Connection
3 Dim periode As String
4 Dim MemPeriode As String
5 Dim AantalRecs As Long
6 Dim ArtGroep As String
7 Dim SQLString As String
8 Dim QryStart As Single, QryEnd As Single, QryEet As Single
9 Dim rcdB As New ADODB.Recordset
10 Dim rcdI As New ADODB.Recordset
11 Dim rcdP As New ADODB.Recordset
12 Set cn = CurrentProject.Connection
13 rcdP.Open "SELECT * FROM TblBonusPeriode", cn, adOpenKeyset,
adLockOptimistic
14 MemPeriode = rcdP!FldBonusPeriode
15 rcdP.Close
16 If MemPeriode = Me!TxtPeriode Then
17 periode = Left$(TxtPeriode, 4) + Right$(TxtPeriode, 2)
18 'verwijderen bonus regels voor desbetreffende periode
19 QryStart = Timer
20 Screen.MousePointer = 11
21 DoCmd.SetWarnings False
22 TxtInfo = "Deleten bonussen voor deze periode"
23 Me.Repaint
24 SQLString = "DELETE * From bonus Where bonus.periode = '" &
periode & "';"
25 rcdB.Open SQLString, cn, adOpenKeyset, adLockOptimistic
regards, Joop
big, several tables of over 500.000 records and a lot of smaller ones.
So I decided to migrate to MS SQL Server.
I imported the tables in SQL server, deleted all tables in Access and
created linked tables in Access.
In every procedure where I use ADODB in my code I get errors.
I tried different connection strings to connect to the SQL Servers tables
straight away. I also tried to connect using the same DSN I used to link the
tables.
Who can help me to determine the right connection string? (or another
solution)
A sample of the code where it goes wrong, the first open (line 13) runs ok
but it does not execute line 24 so probably I have permission to read but
not to delete or write?
1 Private Sub CmdBereken_Click()
2 Dim cn As ADODB.Connection
3 Dim periode As String
4 Dim MemPeriode As String
5 Dim AantalRecs As Long
6 Dim ArtGroep As String
7 Dim SQLString As String
8 Dim QryStart As Single, QryEnd As Single, QryEet As Single
9 Dim rcdB As New ADODB.Recordset
10 Dim rcdI As New ADODB.Recordset
11 Dim rcdP As New ADODB.Recordset
12 Set cn = CurrentProject.Connection
13 rcdP.Open "SELECT * FROM TblBonusPeriode", cn, adOpenKeyset,
adLockOptimistic
14 MemPeriode = rcdP!FldBonusPeriode
15 rcdP.Close
16 If MemPeriode = Me!TxtPeriode Then
17 periode = Left$(TxtPeriode, 4) + Right$(TxtPeriode, 2)
18 'verwijderen bonus regels voor desbetreffende periode
19 QryStart = Timer
20 Screen.MousePointer = 11
21 DoCmd.SetWarnings False
22 TxtInfo = "Deleten bonussen voor deze periode"
23 Me.Repaint
24 SQLString = "DELETE * From bonus Where bonus.periode = '" &
periode & "';"
25 rcdB.Open SQLString, cn, adOpenKeyset, adLockOptimistic
regards, Joop