M
Min
Hi, the following query works in Query design
Update Table1 set CompID =1 Where CompName = 'AACompany'
But, for a recordset in a form module: rsComp.Update set CompID =1 Where
CompName = 'AACompany' it does not work. Anyone can help? How to write the
query for Recordset.Update? I just cannot find sample code.
Dim cnn As ADODB.Connection
Dim rsTable1 As ADODB.Recordset
Dim strSQL As String
strSQL = "Select CompName, CompID From Table1 order by CompName"
Set cnn = CurrentProject.Connection
Set rsTable1 = New ADODB.Recordset
rsTable1.ActiveConnection = cnn
rsTable1.CursorLocation = adUseClient
rsTable1.Open strSQL, , adOpenDynamic, adLockOptimistic
rsComp.Update set CompID = 1 Where CompName = 'AACompany'
Update Table1 set CompID =1 Where CompName = 'AACompany'
But, for a recordset in a form module: rsComp.Update set CompID =1 Where
CompName = 'AACompany' it does not work. Anyone can help? How to write the
query for Recordset.Update? I just cannot find sample code.
Dim cnn As ADODB.Connection
Dim rsTable1 As ADODB.Recordset
Dim strSQL As String
strSQL = "Select CompName, CompID From Table1 order by CompName"
Set cnn = CurrentProject.Connection
Set rsTable1 = New ADODB.Recordset
rsTable1.ActiveConnection = cnn
rsTable1.CursorLocation = adUseClient
rsTable1.Open strSQL, , adOpenDynamic, adLockOptimistic
rsComp.Update set CompID = 1 Where CompName = 'AACompany'