Results 1 to 6 of 6
  1. #1
    kagoodwin13 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    181

    "Auto-fill" on data entry form - need append query to save?

    I have figured out "auto-fill" on a form, as referenced here: https://www.accessforums.net/forms/c...uto-31874.html



    I am looking to add to this capability though. I need a data entry form to input data into a table, but use "auto-fill" fields for user validation. Some suppliers have the same name, but different locations, and therefore different supplier numbers.

    The easiest method to make a data entry form is just to use the form generated by the table, but implementing auto-fill requires referencing other tables. Would I use unbound fields on my form, and then submit the form input data (not auto-filled) to the table via an append query? Or am I going about this the wrong way?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    By 'auto-fill' you mean a textbox referencing value from combobox? What data do you need to save? The textbox values? Why? Will this result in data saved in multiple tables?
    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
    kagoodwin13 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    181
    Yes, I need a text box to reference a combo box value. I need to save the data entered into the combo box values. The text box "auto-fill" is a verification that the user has entered the correct information, and will flag when there is not a match.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Use VBA code to save the values from combobox. The real trick is figuring out what event to put the code in.

    If the field you want to update is included in the form RecordSource:

    Me!fieldname = Me.comboboxname.Column(x)
    or
    Me!fieldname = Me.textbox.name

    If the field is not in the RecordSource then use INSERT or UPDATE sql action:

    CurrentDb.Execute "INSERT INTO ...."
    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
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by kagoodwin13 View Post
    The text box "auto-fill" is a verification that the user has entered the correct information, and will flag when there is not a match
    Quote Originally Posted by kagoodwin13 View Post
    Or am I going about this the wrong way?
    Taking your post at face value, you're actually going about it backwards! Comboboxes are used to facilitate the entering of correct/proper data, not to verify that data already entered is correct! What you would normally do is have the Combobox display the suppliers names, locations, and supplier numbers. Once a selection was made, you'd populate Textboxes on the Form with whichever values you need to save in the underlying Table, using a method like this:

    Set up your Combobox using the Wizard and include the Fields you need, from Left-to-Right.

    If in the Combobox they appear as

    Field1 | Field2 | Field3

    the code would be

    Code:
    Private Sub YourComboBox_AfterUpdate()
       Me.txtField1 =  Me.YourComboBox.Column(0)
       Me.txtField2 = Me.YourComboBox.Column(1)
       Me.txtField3= Me.YourComboBox.Column(2)
    End Sub

    Notice that the column index is Zero-based.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    kagoodwin13 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    181
    Thanks to both of you. Solved!

    I put the VBA code to save the auto-filled text field in the "save button" event. It would not work in After Update on the text box because it was automatically updated and not manually.

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

Similar Threads

  1. How to use "Auto Save" - no more post loss!
    By Matrix in forum Forum Suggestions
    Replies: 6
    Last Post: 11-30-2023, 06:16 PM
  2. saves data with out click "Save" button in forms
    By terrythomasvda in forum Forms
    Replies: 4
    Last Post: 01-14-2013, 01:31 PM
  3. Replies: 2
    Last Post: 09-29-2012, 11:22 PM
  4. Replies: 1
    Last Post: 08-23-2012, 08:32 AM
  5. Replies: 7
    Last Post: 01-29-2012, 07:44 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