Hallo,
The application I have is dependent on a database which will be shut down this weekend, therefore I was instructed to check this specific module and determine how it is connecting to the database and how it fetchs the data. Then I have to take the table from the database and make it static within this access application and link it to it rather than making an ODBC connection. I would appreciate if someone shows me when it fetches the data - the connection is quite clear. When I grey out the connection no data is fetched... Therefore it definately dependent on the ODBC Connection.....
N/B: tblImportPatients is imported by the user when running the application. So initially, it deletes the old table and then creates a new table with the other fields populated.
Also, LoadRef - is a field within tblDuplicateData which is incremented when ever the tblimportedPatients is loaded. Therefore, at the bottom it reads the maximum value for LoadRef which is the recent imported table.
The red highligted section I dont understand at all.
Thanks
Please see the code below;
The application I have is dependent on a database which will be shut down this weekend, therefore I was instructed to check this specific module and determine how it is connecting to the database and how it fetchs the data. Then I have to take the table from the database and make it static within this access application and link it to it rather than making an ODBC connection. I would appreciate if someone shows me when it fetches the data - the connection is quite clear. When I grey out the connection no data is fetched... Therefore it definately dependent on the ODBC Connection.....
N/B: tblImportPatients is imported by the user when running the application. So initially, it deletes the old table and then creates a new table with the other fields populated.
Also, LoadRef - is a field within tblDuplicateData which is incremented when ever the tblimportedPatients is loaded. Therefore, at the bottom it reads the maximum value for LoadRef which is the recent imported table.
The red highligted section I dont understand at all.
Thanks
Please see the code below;
Code:
Sub FetchPatInfo()
'this converts the pateids into a full patient list
Dim i As Integer
strSQL = lblSQL.Caption & " (" & txtCodes & ")"
Set dBS = DBEngine(0)(0)
dBS.Execute "DELETE tblImportPatients.* FROM tblImportPatients"
Set wRK = CreateWorkspace("", "maintain", "maintain77", dbUseODBC)
Set cON = wRK.OpenConnection("odsaccess", , , "ODBC;")
cON.QueryTimeout = 0
Set qDF = cON.CreateQueryDef("", strSQL)
Set rST1 = dBS.OpenRecordset("select * from tblImportPatients", dbOpenDynaset)
Set rST2 = qDF.OpenRecordset()
Dim LdRef As Long
LdRef = DMax("LoadRef", "tblDuplicateData")
[COLOR=red]While Not rST2.EOF
rST1.AddNew
For i = 0 To rST2.Fields.Count - 1
rST1.Fields(i) = rST2.Fields(i)
rST1.Fields(7) = LdRef
Next
rST1.Update
rST2.MoveNext
Wend
[/COLOR]
rST1.Close
rST2.Close
cON.Close
wRK.Close
Set dBS = Nothing
Beep
End Sub