S
Stan S.
I need to find the record in tblResults (Access database) with the largest
entry in the "SPECIMEN" column and I want to do it from VBscript only. I am
after the largest specimen number so I can chose the next highest value for a
new specimen. Specimen numbers are not distinct on the whole but generally
for any "RESULTS NAME" they are.
Also I want to filter on only those records with "srchString" somewhere in
the entry for "RESULTS NAME" column.
I am using the following code to open the database and add records from
VBscript:
Dim dbE 'As DAO.DBEngine
Dim dbW 'As DAO.Workspace
Dim dbD 'As DAO.Database
Dim rsR 'As DAO.Recordset
Set dbE = CreateObject("DAO.DBEngine.36") 'VBS, late binding
'Set dbE = New DAO.DBEngine 'VB/VBA, early binding
dbE.SystemDB = "C:\Progra~1\Micros~4\Office\CMMDEV.mdw"
Set dbW = dbE.CreateWorkspace("Test", "Master", "pswd123")
Set dbD = dbW.OpenDatabase("H:\...\cmmbackend.mdb")
Set rsR = dbD.OpenRecordset("RESULTS OF MEASUREMENT PLANS")
With rsR
MsgBox .Fields(0).Value 'demo only
'Add a record:
.AddNew
.Fields("RESULTS ID").Value = ResultId
.Fields("PARENT PLAN").Value = chitems(ipl)
' ...other fields if needed...
.Update
End With
rsR.Close
Thanks for any help!
entry in the "SPECIMEN" column and I want to do it from VBscript only. I am
after the largest specimen number so I can chose the next highest value for a
new specimen. Specimen numbers are not distinct on the whole but generally
for any "RESULTS NAME" they are.
Also I want to filter on only those records with "srchString" somewhere in
the entry for "RESULTS NAME" column.
I am using the following code to open the database and add records from
VBscript:
Dim dbE 'As DAO.DBEngine
Dim dbW 'As DAO.Workspace
Dim dbD 'As DAO.Database
Dim rsR 'As DAO.Recordset
Set dbE = CreateObject("DAO.DBEngine.36") 'VBS, late binding
'Set dbE = New DAO.DBEngine 'VB/VBA, early binding
dbE.SystemDB = "C:\Progra~1\Micros~4\Office\CMMDEV.mdw"
Set dbW = dbE.CreateWorkspace("Test", "Master", "pswd123")
Set dbD = dbW.OpenDatabase("H:\...\cmmbackend.mdb")
Set rsR = dbD.OpenRecordset("RESULTS OF MEASUREMENT PLANS")
With rsR
MsgBox .Fields(0).Value 'demo only
'Add a record:
.AddNew
.Fields("RESULTS ID").Value = ResultId
.Fields("PARENT PLAN").Value = chitems(ipl)
' ...other fields if needed...
.Update
End With
rsR.Close
Thanks for any help!