S
Steve
Hi EveryBody:
I wrote this code, and its not working...give me
error....
betaData.Channel is not a valid field...eventhough its
a field in the table... any help...
code is here
Option Compare Database
Option Explicit
Private db As DAO.Database
Private bRs As DAO.Recordset
Private cRs As DAO.Recordset
Private sChannel As String
Private sProduct As String
Private sBankPship As String
Private sFincProduct As String
Private dCostCenter As Double
Private vFinder As Variant
Sub Assign_CostCenter()
Set db = CurrentDb
Set bRs = db.OpenRecordset("betaData", dbOpenDynaset)
Set cRs = db.OpenRecordset("tblAssginCostCenter",
dbOpenDynaset)
On Error GoTo ErrorHandler
With cRs
If .RecordCount > 0 Then
.MoveFirst
Else
Resume CloseSub
End If
While Not .EOF
sChannel = !Channel
sProduct = !Product
sBankPship = !BankPship
dCostCenter = !CostCenter
vFinder = "([betaData].[Channel]
='" & sChannel & "' & "
vFinder = vFinder & " [betaData].
[Product]='" & sProduct & "' & "
vFinder = vFinder & " [betaData].
[BankPship]='" & sBankPship & "' )"
With bRs
If .RecordCount > 0 Then
.MoveFirst
Else
Resume CloseSub
End If
While Not .EOF
.FindFirst vFinder
.Edit
!CostCenter =
dCostCenter
.Update
.MoveNext
Wend
End With
.MoveFirst
Wend
End With
CloseSub:
cRs.Close
bRs.Close
db.Close
Set cRs = Nothing
Set bRs = Nothing
Set db = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description, vbCritical, Err.Number
Exit Sub
End Sub
Thanking you in advance for your help.
I wrote this code, and its not working...give me
error....
betaData.Channel is not a valid field...eventhough its
a field in the table... any help...
code is here
Option Compare Database
Option Explicit
Private db As DAO.Database
Private bRs As DAO.Recordset
Private cRs As DAO.Recordset
Private sChannel As String
Private sProduct As String
Private sBankPship As String
Private sFincProduct As String
Private dCostCenter As Double
Private vFinder As Variant
Sub Assign_CostCenter()
Set db = CurrentDb
Set bRs = db.OpenRecordset("betaData", dbOpenDynaset)
Set cRs = db.OpenRecordset("tblAssginCostCenter",
dbOpenDynaset)
On Error GoTo ErrorHandler
With cRs
If .RecordCount > 0 Then
.MoveFirst
Else
Resume CloseSub
End If
While Not .EOF
sChannel = !Channel
sProduct = !Product
sBankPship = !BankPship
dCostCenter = !CostCenter
vFinder = "([betaData].[Channel]
='" & sChannel & "' & "
vFinder = vFinder & " [betaData].
[Product]='" & sProduct & "' & "
vFinder = vFinder & " [betaData].
[BankPship]='" & sBankPship & "' )"
With bRs
If .RecordCount > 0 Then
.MoveFirst
Else
Resume CloseSub
End If
While Not .EOF
.FindFirst vFinder
.Edit
!CostCenter =
dCostCenter
.Update
.MoveNext
Wend
End With
.MoveFirst
Wend
End With
CloseSub:
cRs.Close
bRs.Close
db.Close
Set cRs = Nothing
Set bRs = Nothing
Set db = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description, vbCritical, Err.Number
Exit Sub
End Sub
Thanking you in advance for your help.