Data entry for a table from a form

Discussion in 'Access Forms Coding' started by Haas C, Apr 17, 2013.

  1. Haas C

    Haas C Guest

    Hi all!

    I'm a newbie when it comes to programming VBA and I need some help here. For the sake of simplicity, I am giving an example for just two fields so I can learn the programming technique to capture data entered into a form to be added to a table:

    I have a table called tblContacts
    There are two fields in this table: CompanyName and PhoneNumber

    I created a form where the user can see if a company name exists through a Combo Box with the source being the list of entries in the tblContacts field - if it doesn't, he enters a new company into the a txtCompanyName box and a phone number into the txtPhoneNumber box on the form. Next, user presses a button on the form which would call a VBA procedure which runs and takes the values from txtCompanyName and txtPhoneNumber and adds to the tblContacts table

    I know that you can do this easily through Form Wizard, but I wanted to know how to program this into a VBA procedure. This is a simple example to learn the technique so I cna apply it to one with multiple fields, etc.

    Thank you for your help in advance!
     
    Haas C, Apr 17, 2013
    #1
    1. Advertisements

  2. See my answer in the microsoft.public.access.forms newsgroup. It's usually
    not necessary to ask the same question in multiple closely-related
    newsgroups... if you do, it's best to use cross-posting so the answer will
    show up in both (or all) newsgroups; individual posts of identical questions
    may lead to someone wasting effort answering a question that's already been
    answered.

    --
    Larry Linson
    Microsoft Office Access MVP
    Co-Author, Microsoft Access Small Business Solutions, Wiley 2010

    "Haas C" <> wrote in message
    news:...
    Hi all!

    I'm a newbie when it comes to programming VBA and I need some help here. For
    the sake of simplicity, I am giving an example for just two fields so I can
    learn the programming technique to capture data entered into a form to be
    added to a table:

    I have a table called tblContacts
    There are two fields in this table: CompanyName and PhoneNumber

    I created a form where the user can see if a company name exists through a
    Combo Box with the source being the list of entries in the tblContacts
    field - if it doesn't, he enters a new company into the a txtCompanyName box
    and a phone number into the txtPhoneNumber box on the form. Next, user
    presses a button on the form which would call a VBA procedure which runs and
    takes the values from txtCompanyName and txtPhoneNumber and adds to the
    tblContacts table

    I know that you can do this easily through Form Wizard, but I wanted to know
    how to program this into a VBA procedure. This is a simple example to learn
    the technique so I cna apply it to one with multiple fields, etc.

    Thank you for your help in advance!
     
    Access Developer, Apr 17, 2013
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joan
    Replies:
    6
    Views:
    98
    Rick Brandt
    Sep 19, 2003
  2. Carol Spears via AccessMonster.com

    Speed Data Entry By Pre-populating with previous entry

    Carol Spears via AccessMonster.com, May 9, 2005, in forum: Access Forms Coding
    Replies:
    2
    Views:
    123
    Carol Spears via AccessMonster.com
    May 9, 2005
  3. new-to-this

    Retreive data from table using sql based on entry in form?

    new-to-this, Jul 4, 2005, in forum: Access Forms Coding
    Replies:
    1
    Views:
    72
    John Vinson
    Jul 4, 2005
  4. hfreedman

    New Entry to Pop-Up Entry Form

    hfreedman, Jan 11, 2006, in forum: Access Forms Coding
    Replies:
    1
    Views:
    115
    Allen Browne
    Jan 12, 2006
  5. Pete and Jeannette Smith

    data value in Form field if no table entry

    Pete and Jeannette Smith, Mar 21, 2007, in forum: Access Forms Coding
    Replies:
    3
    Views:
    58
  6. Data Entry India
    Replies:
    0
    Views:
    324
    Data Entry India
    Mar 31, 2008
  7. p-rat
    Replies:
    1
    Views:
    76
    Beetle
    Sep 30, 2008
  8. Chris K
    Replies:
    2
    Views:
    371
    John W. Vinson
    Jul 25, 2010
Loading...