Hi all,
I've tried to find this answer in the help menu and online but haven't found it:
When I type in a field on my form, and then hit backspace to erase what I just typed, my understanding is that the field is now considered zero length, and not null. I have a field on the form that looks up info in another table based on what was just typed in that field (using an After Update event).
I tried, just in case, to use Nz, but as I expected that wasn't the trick.
Is there a way to get the After Update event code to ignore zero length in the same way Nz would ignore a null? Or to convert the zero length to a null and then use Nz?
I've also already tried changing the settings in the field on the table to not allow zero length, but that didn't do it either.
Here's the relevant part of the code for the After Update event on the form:
I've tried to find this answer in the help menu and online but haven't found it:
When I type in a field on my form, and then hit backspace to erase what I just typed, my understanding is that the field is now considered zero length, and not null. I have a field on the form that looks up info in another table based on what was just typed in that field (using an After Update event).
I tried, just in case, to use Nz, but as I expected that wasn't the trick.
Is there a way to get the After Update event code to ignore zero length in the same way Nz would ignore a null? Or to convert the zero length to a null and then use Nz?
I've also already tried changing the settings in the field on the table to not allow zero length, but that didn't do it either.
Here's the relevant part of the code for the After Update event on the form:
Code:
Private Sub ORDER_AfterUpdate()
' Check to see if this client is already in the customers table
If DCount("*", "cust", "[cusname]='" & Me!ORDER & "'") = 0 Then
' Yes No Box
Dim Msg, Style, Title, Response
Msg = "This Customer Name is not in the list. Do you want to add it? (Note: Don't add one-time customers, just clients that we expect to be recurring, such as title companies. If you think this client should already be in the list, check your spelling.)" ' Define message.
Style = vbYesNo ' Define buttons.
Title = "Add Customer" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes
DoCmd.RunMacro "Open Client Information Form"
End If
Comment