Results 1 to 7 of 7
  1. #1
    dekhelia is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2013
    Location
    York, UK
    Posts
    6

    Setting default value to zero in form box?

    I have added a couple of boxes to an access form so that users can input a '1' or a '0' for their data. I want the default value to be '0', but even though I have set this in the fields I have added to the table from which the form takes its 'instructions', the new boxes on the form appear blank ... what am I missing here?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    A control on a form that is bound to a field in a table will represent said field.

    If you look at the table and it shows the value = 0 then the control bound to this field will display the same. The only way around this that I can imagine is if the default value for the control, at the form level, is set to something else.

  3. #3
    dekhelia is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2013
    Location
    York, UK
    Posts
    6
    Thanks very much for your reply. A couple of questions, if I may: having added the fields to the table, and then designed and placed the boxes in the form, would I then need to bind the new parts of the form to the relevant table, or is this done automatically by Access? And: when I look at the Properties of the new boxes on the form in design view, the 'Default value' is "0" (with quote marks), which appears to be the same default value as for the boxes in the form that were already present, and which do display 0 as their default value.

    I appreciate your time!

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Post #3 sounds about right.

    You can drag over fields to your form from a query or table using the "Add Existing Fields" window in design view. This will add a control to your form. It will automatically bind this control to the field in the table or query.

    Alternatively, you can create an unbound control in a form.. You can adjust the properties of this unbound control to be bound to a table or query.

    An unbound textbox will display the word "Unbound" while a bound textbox will display the field name that it represents.

    As for the default value, Not sure why you have zero enclosed with quotes. This may be part of your problem. Take a look at reference material and study up on data types. It is important to use the appropriate data type for each column you build within a table. At the table level, in design view, make sure you set the data type to do the job you need it to do.

    Try to avoid lookup fields in your tables and assign number data types, or text, or Yes/No, etc. where it is appropriate.

  5. #5
    dekhelia is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2013
    Location
    York, UK
    Posts
    6
    Hm. Yes, I dragged the fields into the form in design view, and the boxes display the name of the field they represent. I'll have a tinker with data types, as you suggest, and see what I get. Thanks again.

  6. #6
    dekhelia is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2013
    Location
    York, UK
    Posts
    6
    Update: sorted it. Very basic mistake I was making, of expecting the default values as desired to turn up in previously saved pages of the form (it has over 3,000 entries). Of course, these pages are saved as they were finished by the operators, so I shouldn't have expected any of the boxes to have default values ... and sure enough, when I opened a new blank form, the zeros as default were all present and correct.

    FWIW, the quotes around the zero (looking at it in form design view, on the form properties dialog) seem to be ok - ie, they don't make the function not work. Don't know why, though.

    Thanks for your input, ItsMe, it has been very helpful

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Glad it worked out for you and thank you for posting your resolution/observations

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Automaticly Setting Default Value
    By swicklund in forum Forms
    Replies: 5
    Last Post: 06-17-2013, 08:08 AM
  2. Replies: 6
    Last Post: 10-20-2012, 04:45 PM
  3. Setting default vaulue?
    By djclntn in forum Forms
    Replies: 17
    Last Post: 04-12-2012, 11:20 PM
  4. Setting default value for all records in form
    By robsworld78 in forum Forms
    Replies: 15
    Last Post: 08-14-2011, 12:48 AM
  5. Form Field Default Setting
    By roofbid in forum Programming
    Replies: 3
    Last Post: 12-17-2010, 10:53 AM

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