S
Shelley
I'm getting extremely frustrated... I have the following
on a field's afterupdate event. First, I kept getting
a 'type mismatch' run time error 13 at the 'Set myRS'
line. It won't matter if I get Access to accept my
recordset though, because then it doesn't recognize
the .edit method.
I've been using recordsets for years... this is pretty
simple code... what am I missing?
Private Sub BillPercent_AfterUpdate(Cancel As Integer)
Dim myrs As Recordset, myDB As Database, mySql As String
Set myDB = CurrentDb
mySql = "Select WorkOrder, WorkTask, PercentComplete from
Workorders where [WorkOrder] = '" & Me!WorkOrder & "' and
[worktask] = '" & Me!WorkTask & "'"
Set myrs = myDB.OpenRecordset(mySql, dbOpenDynaset)
With myrs
myrs.Edit
myrs!PercentComplete = Me!BillPercent
myrs.Update
myrs.Close
End With
End Sub
The table 'WorkOrders' has the following structure
Name Type Size
WorkOrder Text 50
WorkTask Text 2
ReleaseNum Text 50
JobNumber Text 50
Description Text 255
Location Text 255
SubRegion Text 50
Price Currency 8
EstMH Single 4
PercentComplete Single 4
BillType Text 15
on a field's afterupdate event. First, I kept getting
a 'type mismatch' run time error 13 at the 'Set myRS'
line. It won't matter if I get Access to accept my
recordset though, because then it doesn't recognize
the .edit method.
I've been using recordsets for years... this is pretty
simple code... what am I missing?
Private Sub BillPercent_AfterUpdate(Cancel As Integer)
Dim myrs As Recordset, myDB As Database, mySql As String
Set myDB = CurrentDb
mySql = "Select WorkOrder, WorkTask, PercentComplete from
Workorders where [WorkOrder] = '" & Me!WorkOrder & "' and
[worktask] = '" & Me!WorkTask & "'"
Set myrs = myDB.OpenRecordset(mySql, dbOpenDynaset)
With myrs
myrs.Edit
myrs!PercentComplete = Me!BillPercent
myrs.Update
myrs.Close
End With
End Sub
The table 'WorkOrders' has the following structure
Name Type Size
WorkOrder Text 50
WorkTask Text 2
ReleaseNum Text 50
JobNumber Text 50
Description Text 255
Location Text 255
SubRegion Text 50
Price Currency 8
EstMH Single 4
PercentComplete Single 4
BillType Text 15