Results 1 to 3 of 3
  1. #1
    aunttoots7 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    2

    Adding new data to a table with a form that also autofills

    I have form set up to enter reservations. I was able to get the form to autofill the Customer info based on an ID from an existing table. However, I now cannot add new customers on the form because they are not in the Customer table yet. Any suggestions??

  2. #2
    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
    The standard approach to this would be, in the AfterUpdate event of the ID Control
    • Use the DCount() function to see if a Record already exists for that Customer
    • If it exists, autofill the data
    • If it doesn't exist, open a Form to fill in the New Customer Data

    This type of thing could be done with a Combobox, then use the Not in List event for adding the New Record.

    Linq ;0)>

  3. #3
    aunttoots7 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    2
    Quote Originally Posted by Missinglinq View Post
    The standard approach to this would be, in the AfterUpdate event of the ID Control
    • Use the DCount() function to see if a Record already exists for that Customer
    • If it exists, autofill the data
    • If it doesn't exist, open a Form to fill in the New Customer Data

    This type of thing could be done with a Combobox, then use the Not in List event for adding the New Record.

    Linq ;0)>
    Thank you for your reply Missinglinq! I'm just trying to learn to write code and really inexperienced. I have a little basic knowledge, but don't have a clue how to write your suggestion. I have created a form to add customers with no problem and have developed a macro to open it which I included in the Not in List event, but I'm not sure how to use the DCount function. Below is my information:
    tCustomers
    cboCustomerID
    fReservations
    I have the combo box (cboCustomerID) autofilling the rest of the customer information currently. I would also like to be able to add a new customer in the event they are not already in tCustomers. How would I write the code using DCount or do you need more information?

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

Similar Threads

  1. Replies: 7
    Last Post: 04-03-2012, 12:29 PM
  2. Replies: 3
    Last Post: 12-19-2011, 11:18 AM
  3. Adding data to a table
    By Jbelle7435 in forum Programming
    Replies: 17
    Last Post: 06-13-2011, 07:30 AM
  4. Replies: 1
    Last Post: 11-04-2010, 12:57 PM
  5. Adding a table cannot enter data
    By tak4 in forum Queries
    Replies: 0
    Last Post: 02-03-2009, 10:04 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