I have a front end Access2000 application and sql server 7.0 back end.
To create reports I query the sql database through OLEDB and insert
the data from the result recordset into a temporary local table.
Obviously this takes a while, especially when the query returns many
records. The problem is that Access stalls while inserting the records
into the temp table, BUT if I go back to access after the screensaver
has kicked in, the report is open and access is working. Has anybody
had the same problem or know why this might be?
TIA,
/Linus
BTW, here´s some of the code:
Set rst = dbs.OpenRecordset("tblStatistik"
sqlStr = "SELECT tblPatient.sjukvårdsområde,
tblPatient.personnummer, " & _
"tblPatient.efternamn, tblPatient.förnamn,
tblHAHJ.modell_namn, tblHAHJ.behålletdatum, " & _
"round(sum([Modell-lista].pris * ((100 -
[Leverantörs-lista].blkrab) / 100)), 0) As rabpris " & _
"FROM tblPatient, tblHAHJ, [Modell-lista],
[Leverantörs-lista] " & _
"WHERE tblHAHJ.behålletdatum BETWEEN '" & startdatum & "'
AND '" & slutdatum & "' " & _
"AND tblPatient.personnummer = tblHAHJ.personnummer " & _
"AND [Modell-lista].modell_namn = tblHAHJ.modell_namn " &
_
"AND [Leverantörs-lista].leverantör =
[Modell-lista].leverantör " & _
"group by tblPatient.sjukvårdsområde,
tblpatient.personnummer, tblPatient.efternamn, " & _
"tblPatient.förnamn, tblHAHJ.modell_namn,
tblHAHJ.behålletdatum;"
Set rst2 = New ADODB.Recordset
rst2.CursorLocation = adUseClient
rst2.Open sqlStr, cnn, adOpenDynamic
While Not rst2.EOF
With rst
.AddNew
![SVO] = rst2("sjukvårdsområde"
![personnummer] = rst2("personnummer"
![efternamn] = rst2("efternamn"
![förnamn] = rst2("förnamn"
![modell] = rst2("modell_namn"
![behålletdatum] = rst2("behålletdatum"
![rabpris] = rst2("rabpris"
.Update
End With
rst2.MoveNext
Wend
rst.Close
Set rst = Nothing
rst2.Close
Set rst2 = Nothing
dbs.Close
Set dbs = Nothing
Screen.MousePointer = 0
DoCmd.OpenReport "Behållda hörapparater per sjukvårdsområde",
acViewPreview
To create reports I query the sql database through OLEDB and insert
the data from the result recordset into a temporary local table.
Obviously this takes a while, especially when the query returns many
records. The problem is that Access stalls while inserting the records
into the temp table, BUT if I go back to access after the screensaver
has kicked in, the report is open and access is working. Has anybody
had the same problem or know why this might be?
TIA,
/Linus
BTW, here´s some of the code:
Set rst = dbs.OpenRecordset("tblStatistik"

sqlStr = "SELECT tblPatient.sjukvårdsområde,
tblPatient.personnummer, " & _
"tblPatient.efternamn, tblPatient.förnamn,
tblHAHJ.modell_namn, tblHAHJ.behålletdatum, " & _
"round(sum([Modell-lista].pris * ((100 -
[Leverantörs-lista].blkrab) / 100)), 0) As rabpris " & _
"FROM tblPatient, tblHAHJ, [Modell-lista],
[Leverantörs-lista] " & _
"WHERE tblHAHJ.behålletdatum BETWEEN '" & startdatum & "'
AND '" & slutdatum & "' " & _
"AND tblPatient.personnummer = tblHAHJ.personnummer " & _
"AND [Modell-lista].modell_namn = tblHAHJ.modell_namn " &
_
"AND [Leverantörs-lista].leverantör =
[Modell-lista].leverantör " & _
"group by tblPatient.sjukvårdsområde,
tblpatient.personnummer, tblPatient.efternamn, " & _
"tblPatient.förnamn, tblHAHJ.modell_namn,
tblHAHJ.behålletdatum;"
Set rst2 = New ADODB.Recordset
rst2.CursorLocation = adUseClient
rst2.Open sqlStr, cnn, adOpenDynamic
While Not rst2.EOF
With rst
.AddNew
![SVO] = rst2("sjukvårdsområde"

![personnummer] = rst2("personnummer"

![efternamn] = rst2("efternamn"

![förnamn] = rst2("förnamn"

![modell] = rst2("modell_namn"

![behålletdatum] = rst2("behålletdatum"

![rabpris] = rst2("rabpris"

.Update
End With
rst2.MoveNext
Wend
rst.Close
Set rst = Nothing
rst2.Close
Set rst2 = Nothing
dbs.Close
Set dbs = Nothing
Screen.MousePointer = 0
DoCmd.OpenReport "Behållda hörapparater per sjukvårdsområde",
acViewPreview