GinaWhipp
AWF VIP
- Local time
- Yesterday, 21:56
- Joined
- Jun 21, 2011
- Messages
- 5,899
I just got another thought, I have rearranged some lines and added a few, let's see if this works...
Code:
Private Sub cboPoCurrency_AfterUpdate()
On Error GoTo ErrHandler
Dim db As Database
Dim strSql As String
[COLOR=red][B]Dim lngID As Long '***Why is this here?
[/B][/COLOR] Dim dblRate As Double
Set db = CurrentDb
[B][COLOR=red] lngID = Me.txtID '***Why is this here?
[/COLOR][/B] dblNCostR = DLookup("ExRate", "Currency", "ID = " & [cboPoCurrency])
dblRate = dblNCostR / dblOCostR
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSaveRecord
Me.txtPOExchRate.Value = dblNCostR
DoEvents
strSql = "UPDATE QuoteLineItems SET QuoteLineItems.UnitCost = [UnitCost] * " & dblRate & _
" WHERE QuoteLineItems.QuoteID = " & Me.txtID & ";"
DoCmd.RunSQL strSql
DoCmd.RunCommand acCmdSaveRecord
DoCmd.SetWarnings True
Set db = Nothing
ExitSub:
Exit Sub
ErrHandler:
Call ErrorAlert
Resume ExitSub
End Sub