Solved Form: Changes in field will update another table thru After Update Event

To see the Immediate Window, try pressing the Ctrl + G key combo.
1581443393403.png
 
Okay, that means your WorkerID field/control is empty. Is it? If not, then double-check the name of the control for the WorkerID field. It could be something like Text86 or something.
 
Okay, that means your WorkerID field/control is empty. Is it? If not, then double-check the name of the control for the WorkerID field. It could be something like Text86 or something.
Yes!!! I just figured it out. I was putting the code in an Event that happens BEFORE the workerID is populated by the AFTERUpdate Event so the WorkerID is was not allowing for the change. I figured it out now.

1581443816135.png
 
Okay, that means your WorkerID field/control is empty. Is it? If not, then double-check the name of the control for the WorkerID field. It could be something like Text86 or something.
Yes. The code you suggested works perfectly! Thank you very much for all your help!
 
Okay. Glad to hear you got it sorted out. Good luck with your project.
One last question regarding syntax - How do I include either error handling or cause the code only to run when the workerID.value is Not Null
The image shows what the event looks like. Sometimes we have to clear the worker name which will clear the worker id and because it's an afterupdate event it will give an error when the workerid is null (as we discovered).

1581445873393.png
 
Two ways, either use:

If Not IsNull(Me.WorkerID) Then
Set rs = ...
...
End If

or use:

strSQL = "SELECT... WHERE EmployeeID=" & Nz(Me.WorkerID,0)

or use both together.
 
Two ways, either use:

If Not IsNull(Me.WorkerID) Then
Set rs = ...
...
End If

or use:

strSQL = "SELECT... WHERE EmployeeID=" & Nz(Me.WorkerID,0)

or use both together.
Perfect. Thank you. Works great. Resolved!
 

Users who are viewing this thread

Back
Top Bottom