Results 1 to 5 of 5
  1. #1
    bbxrider is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Posts
    69

    change default value of a textbox


    I have a textbox with a default value of Path where I write files.
    from time to time the default path needs to be changed. so I set up button to set the
    default value to whatever the current content of the textbox is, eg, the user can change it.
    but can't seem to save the new default value
    what I have tried

    Private Sub Command29_Click()
    Dim newText As String
    Text27.SetFocus
    newText = Text27.Text
    Text27.DefaultValue = Chr$(34) & newText & Chr$(34)
    DoCmd.Save
    MsgBox "Default Folder for reports has been changed to: " & newText

    posts that show changing hard copy text have default = """new value""" indicating you need to supply the quotes

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    Setting that property and saving it requires opening the form in design view, whether done manually or programmatically, must be from design view.
    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.

  3. #3
    bbxrider is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Posts
    69
    so while I have the form open in run mode, I can vba open in design view make the change and save the form without messing up the current status of the active form?

  4. #4
    bbxrider is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Posts
    69
    I am missing something, when I try to set the new value getting an error
    Dim newText As String
    '"C:\Users\rbetz01\Documents\BSC-work\SMU-broker-adoption\Reports\"
    Text27.SetFocus
    newText = Text27.Text
    DoCmd.OpenForm "email_track_rpt_request-form", acDesign
    'Text27.SetFocus (get the error here)
    Text27.DefaultValue = Chr$(34) & newText & Chr$(34) (get the error here)
    DoCmd.Save

    Click image for larger version. 

Name:	error2467-object-closed-nonexist.png 
Views:	6 
Size:	4.8 KB 
ID:	19105

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    Don't need to set focus.
    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.

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

Similar Threads

  1. Replies: 6
    Last Post: 07-24-2014, 04:32 PM
  2. Default in Textbox
    By drunkenneo in forum Forms
    Replies: 7
    Last Post: 11-18-2013, 04:10 AM
  3. Replies: 3
    Last Post: 06-14-2013, 01:50 PM
  4. Textbox default value with datetimeyear
    By Perkowski in forum Access
    Replies: 8
    Last Post: 08-09-2012, 01:37 PM
  5. Replies: 2
    Last Post: 08-06-2011, 12:19 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