Results 1 to 6 of 6
  1. #1
    Zombai is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    24

    Data entry form with 2 'lookup fields.

    I'm trying to create a data entry form, which puts information into a specific table, but has 2 fields that looks up information from a different table.

    Click image for larger version. 

Name:	Capture.PNG 
Views:	13 
Size:	25.0 KB 
ID:	31620

    I want the 'Account Name' and the 'Account Number' to be found from the 'Accounts' table, the 'Customer Number' field generates an AutoNumber, and the other fields will be entered manually.
    The save button will, obviously, save the record.
    The Exit button will close the form.
    The Clear Fields button will erase all data from the form (i need help with this step too)



    The idea is that there are multiple Customer's linked to a single Account, via the Account Number.


    You select the account you want to associate the customer with, then fill in the details and save it.
    Saving it will store all the information in the 'Customers' table.

    I can successfully select an account name, however it will not populate the Account Number field when selected. This causes the 'Customer' to be related to no account from the 'Account' table.

    In the below image, you can see customer number 1, i manually input to and associated the account number (this worked, and was recalled for other test forms).
    Customer 6 was saved using the form in the above image.
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	12 
Size:	15.3 KB 
ID:	31621

    I appreciate your help

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Not understanding the issue. You select account with combobox? Include the account number as first column (can be hidden) of the combobox and set that column as the BoundColumn. The AccountNumber will save. Why duplicate the AccountName into Customers table?
    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
    Zombai is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    24
    Quote Originally Posted by June7 View Post
    Not understanding the issue. You select account with combobox? Include the account number as first column (can be hidden) of the combobox and set that column as the BoundColumn. The AccountNumber will save. Why duplicate the AccountName into Customers table?
    Thanks for the quick response.
    I have already done as you advised.

    If the form is NOT set to 'Data Entry' then it populates the rest of the fields with an existing record (such as first name, last name, phone number etc.), which i do not want it to do.
    If the form IS set to 'Data Entry' then it doesn't populate the Account Number field.

    I want the form to be blank. You then select the account name, it populates the account number field (to visually verify it has selected an account to save against), input customer details, then save the form which creates a new record in the Customers table

    The 'Account Name' field is in the Customers table to make it easier if i need to manually look at the table.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Saving the Account Name into Customers violates relational database principles and requires code to accomplish. Use queries to view related 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.

  5. #5
    Zombai is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    24
    Quote Originally Posted by June7 View Post
    Saving the Account Name into Customers violates relational database principles and requires code to accomplish. Use queries to view related tables.
    Totally irrelevant to the question that i asked.
    But i saw the error in having multiple "account name' fields in different tables. I've not removed all duplicate fields in tables (except Account Number).

    I managed to fix my issue by creating a form for Accounts, with a subform for Customers. The Customers subform is a data entry form and it is all working perfectly.

    Can you explain how to create a button to clear information that is already entered in the subform?
    For example, you fill out the subform, then realise you don't want to add the information anymore. Instead of closing the form without saving, you just clear all data that is already entered, but not saved?

  6. #6
    Zombai is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    24
    For anyone reading this thread in the future, i found an answer to creating a 'clear' button to reset a data entry form.

    Create a button with the Control Wizard turned off - find the 'On Click' event, click the button with the 3 little dots and open the Code Builder - Add 'Me.Undo' between the two lines of code already there (like the image below)
    Code:
    Private Sub Command15_Click()
    Me.Undo
    End Sub
    That's it.

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

Similar Threads

  1. Data Entry Form - Adjusting Other Fields
    By kdbailey in forum Access
    Replies: 3
    Last Post: 03-16-2017, 02:18 PM
  2. Data Entry form with prepopulated fields
    By zmbaker in forum Forms
    Replies: 1
    Last Post: 07-25-2014, 11:42 AM
  3. Sequence of data entry fields in a form
    By Academia in forum Forms
    Replies: 2
    Last Post: 08-01-2013, 08:06 AM
  4. Replies: 7
    Last Post: 11-02-2012, 12:05 PM
  5. lookup next ref on data entry
    By Jackie in forum Access
    Replies: 2
    Last Post: 03-26-2011, 03:40 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