After Update problem

B

Bob Vance

On my form I have a Email text box to show the clients email address and if
I delete it out it should trigger my check , which it does but it does not
update in my table when deleting out the email address! Only works when I
enter one, I have tried rebooting no difference

Private Sub tbEmail_AfterUpdate()
If ckbBatchInvoice.value = 0 Or IsNull(ckbBatchInvoice.value) Then
ckbBatchInvoice.value = -1
Me.Refresh
End Sub
 
J

Jeanette Cunningham

Hi Bob,
If you want it to update the table straight after the checkbox is updated,
without waiting for the form to save the current record, use Me.Requery
instead of Me.Refresh


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jeanette Cunningham

If it doesn't suit to do a requery at this stage, you can write code to
update that value in the table.

Private Sub tbEmail_AfterUpdate()
Dim strSQL As String

strSQL = "Update SomeTable " _
& "Set SomeTable.BatchInvoice = True " _
& "Where SomeTable.IDField = " & Me!IDField & ""

If ckbBatchInvoice.value = 0 Or IsNull(ckbBatchInvoice.value) Then
ckbBatchInvoice.value = -1
CurrentDb.Execute strSQL

End Sub

Note: use your own table and field names instead of SomeTable etc.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Top