D
David M C
Private Sub SORCode_AfterUpdate()
If Me![SORCode] = Null Then
'Do Nothing
Else
Me![Description] = DLookup("[Description]", "ScheduleOfRates",
"[SORCode] = " & Me![SORCode])
Me![Units] = DLookup("[Units]", "ScheduleOfRates", "[SORCode] = " &
Me![SORCode])
Me![Price] = DLookup("[Price]", "ScheduleOfRates", "[SORCode] = " &
Me![SORCode])
End If
Me.Requery
End Sub
I have a table, WorksDetail and a table ScheduleOfRates. My form puts
records into the WorksDetail table. For about 25% of the records, we use what
is known as the Schedule of Rates, which is an industry standard system of
pricing. When one of these codes is entered, I'm trying to "auto-populate"
the Description, Units, and Price fields of my form (or write these records
to the appropriate table).
I've tried using the above DLookup code but I get a data type mismatch error.
Where am I going wrong?
ScheduleOfRates:
SORCode : Text
Description : Text
Units : Text
Price : Currency
WorksDetail:
SORCode : Text
Description: Text
Quantity : Number
Units : Text
Price : Currency
If Me![SORCode] = Null Then
'Do Nothing
Else
Me![Description] = DLookup("[Description]", "ScheduleOfRates",
"[SORCode] = " & Me![SORCode])
Me![Units] = DLookup("[Units]", "ScheduleOfRates", "[SORCode] = " &
Me![SORCode])
Me![Price] = DLookup("[Price]", "ScheduleOfRates", "[SORCode] = " &
Me![SORCode])
End If
Me.Requery
End Sub
I have a table, WorksDetail and a table ScheduleOfRates. My form puts
records into the WorksDetail table. For about 25% of the records, we use what
is known as the Schedule of Rates, which is an industry standard system of
pricing. When one of these codes is entered, I'm trying to "auto-populate"
the Description, Units, and Price fields of my form (or write these records
to the appropriate table).
I've tried using the above DLookup code but I get a data type mismatch error.
Where am I going wrong?
ScheduleOfRates:
SORCode : Text
Description : Text
Units : Text
Price : Currency
WorksDetail:
SORCode : Text
Description: Text
Quantity : Number
Units : Text
Price : Currency