Results 1 to 12 of 12
  1. #1
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51

    Autofill and Validation

    Good Morning,

    I have three forms that are connected in one way or another.

    Team Member Add:


    Three Text Boxes that I want to auto fill and that value be saved with the new record.

    txtTeam and txtTeamID could maybe get their values from cboTeamN from the form Safety Team Points.
    txtTeamMember is either a yes or no answer. In this case all records added will be Yes. So I would like to auto fill this box with the value Yes.

    Team Member Remove:
    txtTeamMember is going to say yes on all records that are pulled into this form.
    I want to make sure that the user can only put Yes or No in this box. I couldnt get the validation rule to work and I am sure its because I am doing something wrong.

    Problems:

    Form Team Member Add:
    Want to auto fill three textboxes and have the value saved with the new record
    Cant auto fill three textboxes when adding a new record.

    Form Team Member Remove:
    Want to make sure that user can only enter Yes or No into the textbox.

    Thanks for the understanding and Help

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    This should help:

    http://www.baldyweb.com/Autofill.htm

    For the second, simplest would be a combo with those 2 selections and limit to list set to yes. Otherwise you'll probably have to test with code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    use a combo box, that has 3 fields.
    pick 1 item, and use the associated columns to fill in the text boxes....
    (note in VB, columns begin with zero)

    Code:
    sub cboClient_Afterupdate()
       txtLastName = cboClient.column(1)
       txtFirstName = cboClient.column(2)
    end sub

  4. #4
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51
    Your first solution I dont think address my issue.
    The form is data entry only and tied to the table.
    All three txtboxes are tied to fields on that table.
    I just dont want the user to have to type values and possiblely mess them up when they are ready exist from infomation on previous form. Also they arent going to know the Team ID.

    I am trying the second solution and I believe that will solve it.(This worked and Thank You)

    Thanks for the help

  5. #5
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51
    Let try again because I cant figure out a solution for my issue.

    I want to use the combobox locate on the Safety Teams Points form to populate the three textboxes located on the Team Member Add form. ranman256 solution doesnt work but thats because of me probaly. I have code under on change for my combobox to run. I can even get a msgbox to return the proper values on load of the form Team Member Add but i cant get it to populate the textbox or to be saved as a new record.


    Problem:
    I want to use combobox locate on one form to populate three textboxes located on another form and than save it all as a new record after some user input.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    So you need to pass the TeamID value to the AddNewMember form. More than one way to accomplish. Code behind AddNewMember can reference the combobox on the calling form.

    If Me.NewRecord Then
    Me.TeamID = Forms!SafetyTeamPoints.comboboxName
    End If

    But where are the team member info coming from? Shouldn't user be entering this data? If there is a master table of all people then use combobox with a RowSource pulling from that table.

    Open the form with acDialog which will suspend execution of code on the calling form until the popup is closed.

    DoCmd.OpenForm "AddNewMember", , , , acFormAdd, acDialog
    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.

  7. #7
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51
    June7

    So Team and Team ID will come from the combobox off of the form "Team Safety Points"
    Team Member will always be " Yes" because that is what they are doing. Adding a new member. The Yes is used later on if we need to remove the member from a team. Also The form "Team Safety Points" keeps everything related to the team selected in the combo box. Should I hard code the "Yes"? Team Member Add is a data entry form only

    Ideally when they click the button to add new member all they would see is a textbox for First Name and Last Name

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Not following data structure. Are you maintaining history of team members? Is that the reason for Yes/No field? Default the field to Yes for new record.

    Post info on table structures and relationships.
    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.

  9. #9
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51
    June7

    Yes, I am maintaining history of team members and that is the reason for the Yes/No field. I also design the main menu to work from team. So, once you select a team on the main menu using the combobox that selection limits all other choices to that specific team including other combo boxes on other forms. Now, of course, the section on the Main Menu form that says Whole Team doesnt fall under the combo restrictions that I have put on the selection under the individual Team section.

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    What's the difference between individual teams and whole teams?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #11
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51
    The Individual Teams section deals with only one team at a time where whole(sholud have been All) teams deal with every team in the company. So if you click a button under the whole team section you get information on all of the company times where as if you click something under individual teams you only get that teams information that has been selected in the combobox locate on the main menu

  12. #12
    Daisy509th's Avatar
    Daisy509th is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Central Texas
    Posts
    51
    Thank Everyone for their help. I got this solved.

    I created a module with Public TeamName_gobal then under the combobox I put an event after update TeamName_gobal = cboTeamName.Value. The the last thing I did was on the form TeamAdd was put an event on load and typed Me.TeamID = TeamName_gobal.

    This now autofills the form .

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

Similar Threads

  1. Replies: 4
    Last Post: 12-05-2017, 03:31 PM
  2. Replies: 2
    Last Post: 06-16-2015, 03:52 AM
  3. Replies: 1
    Last Post: 02-14-2015, 02:29 AM
  4. Autofill
    By ukmale65000 in forum Forms
    Replies: 16
    Last Post: 11-07-2013, 04:09 PM
  5. Autofill
    By kdcooper88 in forum Access
    Replies: 1
    Last Post: 09-18-2010, 05:52 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