You must have some code attached to that field somewhere on the form. In the before Update event of the form perhaps?
Can you show us?
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
Okay, post that code.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The table field(s) for the control(s) involved must have their properties set to either (or both) not allow Null or empty strings. By not providing a value, you're violating this constraint. If that's the case, best to remove the restriction.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Where is this part? This is what I want to know.
Thanks.
I'm going to assume you're very new at all of this, so please excuse if I make it longer than you need.
The setting for allowing/disallowing Null or empty string can be found in the table(s) that are
a) involved in the query behind a form/report or
b) in the table (singular) that is behind the form or report
You have to figure out what the form is bound to, table or query. If table, open it in design view and select the fields that are involved. The properties for the selected field should be visible toward the bottom of your screen. Look for allowing null (officially "Required") or empty string (officially "Allow Zero Length". If Required is True/Yes, the field cannot be blank - something has to be saved in that field for every record, even if it's an empty string. If Allow Zero Length is False/No, empty strings aren't allowed either. If we're on the right track, likely it is a Required issue and not one of zero length because I think it's rare that anyone stores an empty string in a required field. Not all fields have the same properties.
If query, open the query in design view and see how many tables are involved. The controls on the form could be bound to any of the tables that make up the query. If you can't tell what fields are involved for the problem form controls, you'll have to look at the form in design view. There you can identify what the record source is for the form as well as what fields are bound to the problem controls by looking at the property sheet. When the form is selected, you can discover the source behind the form. When the control is selected, you can discover what field the control is bound to.
Gotta run.
Thanks.I'm going to assume you're very new at all of this, so please excuse if I make it longer than you need.
The setting for allowing/disallowing Null or empty string can be found in the table(s) that are
a) involved in the query behind a form/report or
b) in the table (singular) that is behind the form or report
You have to figure out what the form is bound to, table or query. If table, open it in design view and select the fields that are involved. The properties for the selected field should be visible toward the bottom of your screen. Look for allowing null (officially "Required") or empty string (officially "Allow Zero Length". If Required is True/Yes, the field cannot be blank - something has to be saved in that field for every record, even if it's an empty string. If Allow Zero Length is False/No, empty strings aren't allowed either. If we're on the right track, likely it is a Required issue and not one of zero length because I think it's rare that anyone stores an empty string in a required field. Not all fields have the same properties.
If query, open the query in design view and see how many tables are involved. The controls on the form could be bound to any of the tables that make up the query. If you can't tell what fields are involved for the problem form controls, you'll have to look at the form in design view. There you can identify what the record source is for the form as well as what fields are bound to the problem controls by looking at the property sheet. When the form is selected, you can discover the source behind the form. When the control is selected, you can discover what field the control is bound to.
Gotta run.
First practice Access Application, more about learning experience, but I have quite some experience on Excel VBA.
What do you mean in the table? Those input textbox(found in menu bar) are in a Form, not associating with any tables. I just want my code to check these two textbox values, if anyone of them is blank, the error message and Exit Sub; if no blank textbox, then connecting to database and acLink a table. These textbox values are not going to entered into any tables.
Those textboxes are not BOUND to fields?
What are Username and Password - fields or declared variables? If declared String variables, strings cannot hold Null, only Variant type can hold Null.
I do not see a procedure in that image.
Should normally post code as text between CODE tags, not images.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
It is inside a form only, nothing to do with Table/Query. Username and Password are variable, associating with a button (on click event).Code:Private Sub CommandSubmit_Click() Dim Username As String Dim Password As String Username = TextBoxUsername.Value Password = TextBoxPassword.Value End Sub
I don't want to post all my codes, but this part can already cause the error. I think that is something textbox property issue, but I looked through it, could not find anything related to my issue.
Thanks.
As I said, string variable cannot hold Null and that causes 'invalid use of Null' error. Test for Null.
If IsNull(Me.TextboxUsername) Then
'Do this
Else
'Do this
End If
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Attached: By the way, in Excel Form textbox, there is password character, why I could not find it in Access Form textbox? I want to replace password with * when typing the password.
Thanks.