WhizzkidWallace
Registered User.
- Local time
- Today, 21:49
- Joined
- Jan 10, 2005
- Messages
- 49
Hi,
I have a problem updating records with data from a form. Here is the scenario. I have two fields on the form, which create two variables 'intContractNumber' and 'curRetentionHeld'. When I click my Accept button, I want to locate the record in a recordset and write the new data. Here is the code
Dim strSQL As String
Dim conTemp As ADODB.Connection
Set conTemp = CurrentProject.Connection
Dim rsTemp As New ADODB.Recordset
rsTemp.ActiveConnection = conTemp
strSQL = "SELECT tblAccountsSalesLedgerRetentions.ContractNumber, tblAccountsSalesLedgerRetentions.RetentionHeld FROM tblAccountsSalesLedgerRetentions WHERE (((tblAccountsSalesLedgerRetentions.ContractNumber)=" & Str(intContractNumber) & "))"
rsTemp.Open strSQL
If (rsTemp.EOF) Then
MsgBox "Record NOT found"
Else
rsTemp![RetentionHeld] = curRetention
End If
rsTemp.Close
Set rsTemp = Nothing
Set conTemp = Nothing
It results in an error when the ' rsTemp![RetentionHeld]...line runs.
Thanks
I have a problem updating records with data from a form. Here is the scenario. I have two fields on the form, which create two variables 'intContractNumber' and 'curRetentionHeld'. When I click my Accept button, I want to locate the record in a recordset and write the new data. Here is the code
Dim strSQL As String
Dim conTemp As ADODB.Connection
Set conTemp = CurrentProject.Connection
Dim rsTemp As New ADODB.Recordset
rsTemp.ActiveConnection = conTemp
strSQL = "SELECT tblAccountsSalesLedgerRetentions.ContractNumber, tblAccountsSalesLedgerRetentions.RetentionHeld FROM tblAccountsSalesLedgerRetentions WHERE (((tblAccountsSalesLedgerRetentions.ContractNumber)=" & Str(intContractNumber) & "))"
rsTemp.Open strSQL
If (rsTemp.EOF) Then
MsgBox "Record NOT found"
Else
rsTemp![RetentionHeld] = curRetention
End If
rsTemp.Close
Set rsTemp = Nothing
Set conTemp = Nothing
It results in an error when the ' rsTemp![RetentionHeld]...line runs.
Thanks