Results 1 to 7 of 7
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862

    Set table.field default from a form.

    The previous thread helped some, but now....

    I have looked on the net etcetra, but still don't see how you use a form to set the default value of a field from a form control.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    in the property of the text box on the form...
    DEFAULT VALUE
    set it to what you want.

  3. #3
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    I didn't state it clearly enough. I do not want the use to go into the form properties, but to have a button/radial/toggle means to change the default. The default would be changed periodically.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    I have a table , tConfig.
    it has my default settings for certain things.

    at form load event, load your 'default'
    txtBox = Dlookup("[setting],"tConfig","[field]='Qty'")

  5. #5
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    I have this so far: It works where I can choose the value of NIE.

    Private Sub Form_Load()
    Me![NIE].Visible = False
    End Sub
    Private Sub NIE_Def_Click()
    If Me![NIE_Def] = True Then
    Me.[NIE].Visible = True
    Else
    Me.[NIE].Visible = False
    End If
    End Sub

    I am thinking that I need to have a formula in the Forms NIE field under default for this to work correctly. This is what I am trying to change on the fly.

    Thanks

  6. #6
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    (1 line)
    Private Sub NIE_Def_Click()

    NIE.Visible = NIE_Def


    if you just want to assign the default value, just assign it.... txtbox = MyDefltvalue

  7. #7
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    Thanks ranman256. The one liner worked.

    Does the txtbox = MyDefltvalue set the value until it is changed? I tried it by doing the following:

    Private Sub NIE_Def_Click()
    txtbox = MyDefltvalue
    NIE.Visible = NIE_Def
    END SUB

    It makes the first record in the table change the NIE Value, but when I input a new record, it equals the lowest value in the list.

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

Similar Threads

  1. Form field default to 0 with no records
    By shank in forum Forms
    Replies: 17
    Last Post: 01-16-2014, 11:15 AM
  2. Replies: 4
    Last Post: 12-21-2011, 02:45 AM
  3. Form Field Default Setting
    By roofbid in forum Programming
    Replies: 3
    Last Post: 12-17-2010, 10:53 AM
  4. Default Value in table = Field plus 3 days
    By AmyLynnHill in forum Access
    Replies: 1
    Last Post: 08-03-2008, 01:58 AM
  5. Replies: 1
    Last Post: 12-09-2005, 09:27 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