Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163

    How to allow textbox to be blank?

    Attached (Runtime error: 94)

    Some textbox can be skipped during a form data entry. How to set textbox as not required?

    Thanks.



    Click image for larger version. 

Name:	Error 94.PNG 
Views:	10 
Size:	4.3 KB 
ID:	35445

  2. #2
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    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 ↓↓

  3. #3
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Quote Originally Posted by Minty View Post
    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?
    No code directly attached to the textbox, but there is code(referring to those text box) attached to Button (in the same form)

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    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.

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    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.

  6. #6
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Quote Originally Posted by Micron View Post
    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.

    Where is this part? This is what I want to know.

    Thanks.

  7. #7
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Quote Originally Posted by June7 View Post
    Okay, post that code.
    Attached: It could not pass first line of code.

    Click image for larger version. 

Name:	1line.JPG 
Views:	9 
Size:	24.9 KB 
ID:	35448

  8. #8
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    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.

  9. #9
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Quote Originally Posted by Micron View Post
    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.

    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.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    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.

  11. #11
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Code:
    Private Sub CommandSubmit_Click()
    
    
    Dim Username As String
    Dim Password As String
    
    
    Username = TextBoxUsername.Value
    Password = TextBoxPassword.Value
    
    End Sub
    It is inside a form only, nothing to do with Table/Query. Username and Password are variable, associating with a button (on click event).

    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.


    Quote Originally Posted by June7 View Post
    Those textboxes are not BOUND to fields?

    What are Username and Password - fields or declared variables?

    I do not see a procedure in that image.

    Should normally post code as text between CODE tags, not images.

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    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.

  13. #13
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Quote Originally Posted by June7 View Post
    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
    Thanks. Excel VBA can handle it.

  14. #14
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Quote Originally Posted by June7 View Post
    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
    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.
    Attached Thumbnails Attached Thumbnails Password.JPG  

  15. #15
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163
    Quote Originally Posted by VAer View Post
    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.
    Never mind, it is called Input Mask in Access. I just found it.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-31-2018, 04:06 PM
  2. Replies: 1
    Last Post: 03-30-2015, 10:57 AM
  3. Replies: 2
    Last Post: 05-06-2013, 02:17 AM
  4. Replies: 5
    Last Post: 04-23-2012, 12:40 PM
  5. Filling in blank textbox on a report.
    By cowboy in forum Reports
    Replies: 3
    Last Post: 04-16-2010, 02:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums