View Single Post
  #3  
Old January 4th, 2010, 06:29 PM posted to microsoft.public.access.forms
Pamela
external usenet poster
 
Posts: 193
Default Value Entered Isn't Valid...Error

Hi, Dorian,
I little more guidance would be great. I'm very green. I don't understand
what you said about "form-related validations in the form's BeforeUpdate
event." My thinking is if the form runs the code before the user even starts
to fill it in, how will the code find entries that are input after the code
runs...?? I am a little worried about using default values because my users
tend to get very lazy and don't always pay attention to fields they don't
HAVE to update so if they all start blank...they have to fill it in. I do
understand about the No Entry = None, but I'm a little worried about
implementing it. Perhaps a query...?? Thanks for any additional help!

"Dorian" wrote:

I would perform all your form-related validations in the forms BeforeUpdate
event.
Don't use the Exit event for the control.
Another alternative would be to set the default for the control to the
'none' entry in the list.
However, it would be preferable to allow no entry for this control to
represent 'none'.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"Pamela" wrote:

I have a cbo ShopName on my subform which is populated by ltblShop. The cbo
displays the Name, but is bound by the ShopID. If the user doesn't enter a
value, I want a msgbox to open confirming this and then entering "None",
which is an item in my ltblShop. Admittedly, the idea of having a tbl for
Shops which then has a "None" entry which isn't a shop feels wrong but seemed
to be the most expedient at the time and easiest for such the novice that I
am. The code for this upon entering and exiting that control seems to work
fine. The box opens upon a Null entry and will put "None" as directed. The
problem comes in when I later refer to that control in code to concatenate it
into text to copy. The copy operation gives me a "The operation has been
canceled" error and then I get "The value entered isn't valid..." error and
the system sets focus back to this control.
Here is my code:
Private Sub ShopName_Exit(Cancel As Integer)
If Len(Me.ShopName & vbNullString) = 0 Then
If MsgBox("Are you sure there's no shop?", vbYesNo, "Enter Shop") =
vbYes Then
Me.ShopName = "None"
Else
Me.ShopName.SetFocus
End If
End If
End Sub
**Note, if a ShopName is entered, the whole form works perfectly - it's only
on this "None" portion that it stops up.
Thanks so much for help!!
Pamela