J
jerryk
Hi,
I am upsizing an application that uses a querydef to drive reports.
The Querydefs are dynamically created prior to launching the report.
The report then uses the querydef as it's data source.
The code is of the form:
SQL = "Select ....WHERE ID = " & passedID & " AND Type = " & PassedType
Set Myqry = db.CreateQueryDef("rptQry", SQL)
Set qr = db.OpenRecordset("rptQry", , dbSeeChanges)
If qr.EOF Then
Msgstr = "No records " & str(passedID )
Exit Function
End If
qr.close
db.close
' Open report based on querydef
DoCmd.OpenReport "MyReport", acViewPreview
Since switching to SQL Server as the database I am getting the error:
"You must use the dbSeeChanges option with OpenRecordset when accessing
a SQL Server table that has an IDENTITY column."
A simple addition of dbSeeChange did not fix the problem. So I am
wondering if there is a better approach. Since there is a bit of code,
I prefer to continue to use the QueryDef if possible.
Thanks,
jerry
I am upsizing an application that uses a querydef to drive reports.
The Querydefs are dynamically created prior to launching the report.
The report then uses the querydef as it's data source.
The code is of the form:
SQL = "Select ....WHERE ID = " & passedID & " AND Type = " & PassedType
Set Myqry = db.CreateQueryDef("rptQry", SQL)
Set qr = db.OpenRecordset("rptQry", , dbSeeChanges)
If qr.EOF Then
Msgstr = "No records " & str(passedID )
Exit Function
End If
qr.close
db.close
' Open report based on querydef
DoCmd.OpenReport "MyReport", acViewPreview
Since switching to SQL Server as the database I am getting the error:
"You must use the dbSeeChanges option with OpenRecordset when accessing
a SQL Server table that has an IDENTITY column."
A simple addition of dbSeeChange did not fix the problem. So I am
wondering if there is a better approach. Since there is a bit of code,
I prefer to continue to use the QueryDef if possible.
Thanks,
jerry