473,323 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

me.refresh causes 'field cannot contain Null value' error

Hi - I have a combo box field on a form. The field is required (can't be left blank). Occassionally a user will come to the field and the combo box will not contain the desired record. So I added a button that takes the user to a place where they can add a record and all its associated information. Then once the user closes that form and goes back to the combo box, of course the new record isn't in there. So I added a me.refresh to the GotFocus event. Seemed obvious and I've used this before with success. But now whenever I enter the field, I get a Run-time error '3314' with the label: "The field 'Order.Vendor_ID' cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field."

I've tried using me.requery also (don't really know the difference), but I get the same result. I've tried adding a me.required = false before the me.refresh and then putting the me.required = true back on. It wouldn't let me do that.

I'm not sure what else to try.

Any help you can provide would be greatly appreciated.

Thanks
Bill
Sep 2 '09 #1
5 4815
Is the combobox bound. If it is then when they start typing their info into the box it would be making the record "dirty". If the record is dirty, then they remove the information, then it would be interpreted as an empty value. The me.refresh is causing a save (somebody is gonna talk bad about me for using the word save) and now the record is dirty and the field is empty. Is this the same box as your other question?

Afterupdate of the combobox could be
Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty Then
  2.     if me.combobox = "" then
  3.         me.undo
  4.     end if
  5. end if 
Sep 2 '09 #2
FishVal
2,653 Expert 2GB
I would say it is Combobox control that needs to be required, not form.
Sep 2 '09 #3
Interesting. But no luck as yet.

I added the code above in the Afterupdate (substituting vendor_id which is the name of the combobox for the word combobox above). The me.refresh is in the Gotfocus event.

Now I get the same error the first time I enter the field.

And yes, it's the same field as the other post.
Sep 2 '09 #4
Hi FishVal - I'm sorry but I don't understand. If the me.refresh is causing a save of the record and that's not allowed when the field is required and that's why i'm getting the error, then i'd like to turn off the required value, do the refresh and then turn the required back on.

I tried vendor_id.required = false (vendor_id is name of combobox), but that didn't work.
Sep 2 '09 #5
Never mind everyone and thanks for trying to help.

me.refresh was wrong

combobox_name.requery was right

refresh causes record to commit and validation rules caused error

requery doesn't cause a recommit and doesn't create the error.

still having the problem that's mentioned in my other post of typing a few characters, then backing up over them and then trying to leave the field and getting the validation error.
Sep 2 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Krechting | last post by:
Hi ALl, I have a code that checks if the documents in a hyperlink field are still where they should be. I use fileexist(). First I want to filter out all the hyperlink fields that are empty. I...
10
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
9
by: Mr Newbie | last post by:
Before someone flames me, I know this is the VB.NET groups, nonetheless, the asp.net guys seems to have almost disapeared from the aspnet groups so I thought I would ask this here. I have a...
7
by: Tizzah | last post by:
What is wrong with that? regex = /^(http|https):\/\/+({1}+)*\.{2,5}(({1,5})?\/.*)?$/ if(field.hpage.value != regex.test(field.hpage.value)){ alert("Bad Homepage") field.hpage.focus()...
0
by: Liming | last post by:
Hi, I designed a few DataSet Tables in the typed dataset dsigner. Recently, I encountered an error saying Failed to enable constraints. One or more rows contain values violating non-null,...
2
by: Mikus Sleiners | last post by:
I have a control - textBox1 that is binded to objects propery - "Currency" and another control - textBox2 (read only) that is also binded to same propery. Now, i have a situation where textbox1...
1
by: Aegixx | last post by:
Ok, extremely wierd situation here: (I'll post the code below, after the explanation) I've got a Windows application (.NET 3.5) that has a single Form with a DataGridView embedded. The user...
1
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
4
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.