Hi Allen,
Well how do I clear the events for the control. Here is the code for the
evernt that is running:
Private Sub cboCust_ID_BeforeUpdate(Cancel As Integer)
vCust = cboCust_ID
txtComp_Name = DLookup("[Comp_Name]", "Customers", "[Cust_ID]='" & vCust
& "'")
txtInv_Add_TRD1_Name = DLookup("[Comp_Name]", "Customers", "[Cust_ID]='"
& vCust & "'")
txtInv_Add_TRD1_Street = DLookup("[St_Add]", "Customers", "[Cust_ID]='" &
vCust & "'")
txtInv_Add_TRD1_City = DLookup("[City]", "Customers", "[Cust_ID]='" &
vCust & "'")
txtInv_Add_TRD1_County = DLookup("[Region]", "Customers", "[Cust_ID]='" &
vCust & "'")
txtInv_Add_TRD1_PCode = DLookup("[P_Code]", "Customers", "[Cust_ID]='" &
vCust & "'")
txtInv_Add_TRD1_Country = DLookup("[Country]", "Customers", "[Cust_ID]='"
& vCust & "'")
txtInv_Add_TRD1_Tel = DLookup("[Phone]", "Customers", "[Cust_ID]='" &
vCust & "'")
txtInv_Add_TRD1_Fax = DLookup("[Fax]", "Customers", "[Cust_ID]='" & vCust
& "'")
txtInv_Add_TRD1_Email = DLookup("", "Customers", "[Cust_ID]='" &
vCust & "'")
If txtTELisInv = "" Then
Me.txtTELisInv = Me.cboCust_ID
End If
Me.cboDel_Add_Name.Requery
Me.cboProd_ID.Requery
Me.txtCore.SetFocus
End Sub
I just don't get why it isn't clearing, because that is that last line of
code that it is failing on. Why doesn't it wait for everything to
execute fully and move on line by line. I am confused.
Please help
Jarryd.
[QUOTE="Allen Browne"]
Before the focus can move to another control (in response to the
SetFocus), Access must clear any pending events for the control that
currently has focus.
That could include things like:
- the KeyDown, KeyPress, KeyUp, Change, BeforeUpdate, AfterUpdate,
LostFocus, and Exit events of the *control*,
- the KeyDown, KeyPress, KeyUp (if KeyPreview is on), and Error events
of the form,
- actions associated with an AutoKeys macro,
- any other events that are triggered by code or macro in any of those
events.
The error message probably means that you are trying to force something
to happen in one event that cannot be done, because there are
unprocessed events that must be cleared first.
As a simple example, if an unbound control has its Format property set
to Short Date, and you enter an invalid date such as:
29/29/2005
the form's Error event fires, and you are stuck in the control until you
make a valid entry.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
I have an unbound form which includes a whole bunch of unboud controls.
For some reason I cannot use SetFocus. I get error 2108. I tells me
that i have to save the field first. What on earth could it mean?
When I setfocus in a similar event procedur it works fine. I am so
confused.
Please help,
Jarryd
[/QUOTE]
[/QUOTE]
[/QUOTE]