FinalPrime
Technical User
I need some help with SQL Server .
I'm still Access 2000 bound.
cn is Active Connection to Server
dtemp is Access Current()
rsServer is recordset to Server
rstAccess is recordset with Access
r.Open "tblAccess", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
acct = rstAccess![AccountNumber]
sql = "SELECT tblOnServer.AccountID FROM tblOnServer "
sql = sql & "WHERE tblOnServer.ID ="&acct&" ;"
Set rsServer = New ADODB.Recordset
With rsServer
.ActiveConnection = cn
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Source = sql
.Open
End With
If <rsServer rows are returned> then
<do this>
else
<do that>
end if
In an Access ADO recordset, I would use the 'RecordCount' value. If it were zero, then
the above code would execute <do that>
However, I need to look for zero records returned with the rsServer recordset. If using COUNT to determine if > 0, I'd have to run a second SQL query to get the data?
I simply want to update an Access table if rows are returned in a SQL Server query.
Seems simply to me. However, I'm new to SQL Server coding.
Any help will be appreciated.
Thanks in advance,
FinalPrime
member S.A.G.A
(Society Against Geek Acronyms)
I'm still Access 2000 bound.
cn is Active Connection to Server
dtemp is Access Current()
rsServer is recordset to Server
rstAccess is recordset with Access
r.Open "tblAccess", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
acct = rstAccess![AccountNumber]
sql = "SELECT tblOnServer.AccountID FROM tblOnServer "
sql = sql & "WHERE tblOnServer.ID ="&acct&" ;"
Set rsServer = New ADODB.Recordset
With rsServer
.ActiveConnection = cn
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Source = sql
.Open
End With
If <rsServer rows are returned> then
<do this>
else
<do that>
end if
In an Access ADO recordset, I would use the 'RecordCount' value. If it were zero, then
the above code would execute <do that>
However, I need to look for zero records returned with the rsServer recordset. If using COUNT to determine if > 0, I'd have to run a second SQL query to get the data?
I simply want to update an Access table if rows are returned in a SQL Server query.
Seems simply to me. However, I'm new to SQL Server coding.
Any help will be appreciated.
Thanks in advance,
FinalPrime
member S.A.G.A
(Society Against Geek Acronyms)