Results 1 to 7 of 7
  1. #1
    Richard_Marx is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2013
    Posts
    36

    Use 1 Form To Show Old Data And New Data


    I have a form that is displaying previous data that is already input for review (non-editable), and I need a way (preferably the same form) to input new data.

    For the newly input data, I have a button that has a label displayed that states "Add New Data" --> and they will input an employee id then on the
    Code:
    empID_Change()
    event I am running a procedure to query my database and auto-fill several of the fields. Now the question I have at hand is, how can I differentiate between a newly added record (where data should auto-populate) and an old record (where data should not populate)?

    What recommends would the more advanced users have to accomplish this?

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,478
    Check for data on one of the auto-populated fields, it if is null, then auto-populate the record, if there is data then don't? Make sure it is a field that will always have data.

    On the design, I would suggest displaying the records on a form(lock the fields so it cannot be edited). Then at the top put you Add New button and when clicked, pop up a Form to enter a nre record. When it opens you can pre-fill the data as needed. Once they save the data and close that pop up Form, (OnClose event of the popup) Requery your main Form so the new record now shows.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    If the form is a master/child form,
    the sub form would show old data.
    then click a button, or a tab, to change the sub form to New records.

  4. #4
    Richard_Marx is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2013
    Posts
    36
    Quote Originally Posted by Bulzie View Post
    Check for data on one of the auto-populated fields, it if is null, then auto-populate the record, if there is data then don't? Make sure it is a field that will always have data.
    Address will never be null, so implement a check such as
    Code:
    If Me![Add1] <> "" Then
        GetDataFromDB
    End If
    Afterthought --> If the text box is bound field, will I be able to write the query result to the text box?

  5. #5
    Richard_Marx is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2013
    Posts
    36
    Quote Originally Posted by ranman256 View Post
    If the form is a master/child form,
    the sub form would show old data.
    then click a button, or a tab, to change the sub form to New records.
    It is currently one form so I assume that would be a master form. I do not have a parent/child or master/child set-up. Would that be the best way to go to achieve what I am after?

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,478
    I think it would be
    If Me![Add1] = "" Then
    GetDataFromDB
    End If

    You want to add the data if there is no value in that field right?

  7. #7
    Richard_Marx is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2013
    Posts
    36
    Quote Originally Posted by Bulzie View Post
    I think it would be
    Code:
    If Me![Add1] = "" Then
        GetDataFromDB
    End If
    You want to add the data if there is no value in that field right?
    Thank you for catching my rookie mistake there!

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

Similar Threads

  1. Creating a form that can show my data
    By Dusty in forum Database Design
    Replies: 2
    Last Post: 02-08-2016, 05:29 PM
  2. Replies: 2
    Last Post: 12-11-2015, 02:55 PM
  3. How do I show meaningful data in a sub-form?
    By richardcb in forum Forms
    Replies: 12
    Last Post: 06-26-2014, 09:45 PM
  4. How to show data in Access Form
    By riaarora in forum Access
    Replies: 5
    Last Post: 08-22-2012, 07:25 PM
  5. Show related data on a form
    By Accessgrasshopper in forum Forms
    Replies: 4
    Last Post: 03-17-2011, 07:53 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