Results 1 to 9 of 9
  1. #1
    wade is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2021
    Posts
    2

    data input form

    I have an input form where I can enter data for the first time and also add/correct data. The situation:


    --when I add data it simply creates a 2nd record which isn't what I want
    --when I subsequently open the input form all input fields are blank (empty) which is good
    to solve the 2nd record problem I changed the form's data entry field to 'no' and it does exactly what I want. It does not create a second record, but simply adds the data to the original record.
    --but, when I subsequently open the input form all input fields are filled with data most recently entered.

    How do I have both aspects that I need? That is, the input form simply adds the new data to the existing record and reopens with all input fields empty.

    Wade

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    If you set data Entry to Yes, you can only add records. If no, you can Edit/Add/Delete records.
    So you open the form in the mode that you want, or set properties like AllowDeletions to False, so records cannot be deleted. Can be done in form design properties as well, but sounds like you want to chop and change.?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    I usually set the form's Cycle property = Current Record too so that if a user is [Tab]ing through input boxes that it doesn't automatically cycle to the next / new record when they tab past the last control. (Form's property sheet -> Other Tab -> Cycle)

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Quote Originally Posted by kd2017 View Post
    I usually set the form's Cycle property = Current Record too so that if a user is [Tab]ing through input boxes that it doesn't automatically cycle to a new record when the tab past the last control. (Form's property sheet -> Other Tab -> Cycle)
    Now I had to enter over 5k worth of records, so I did the complete opposite.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    *depending on the purpose of the form

  6. #6
    wade is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2021
    Posts
    2
    Quote Originally Posted by Welshgasman View Post
    If you set data Entry to Yes, you can only add records. If no, you can Edit/Add/Delete records.


    So you open the form in the mode that you want, or set properties like AllowDeletions to False, so records cannot be deleted. Can be done in form design properties as well, but sounds like you want to chop and change.?

    The data entry form is being developed for users. They simply need a form that allows entry of initial data to create a record of the client in the database. At some time in the future they will need to add data to the record. So they open the data entry form (which should be a screen of empty fields, not ones containing the data showing what has been most recently entered for some other client's record). They enter the fields identifying the record they need to add data to, add the data, close the form (which adds the new data). Again, the data entry form , when opened next, should be a screen of empty fields.

    thanks

    sure appreciate any help.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    So dataentry = yes
    If you are going to use the same form to edit data, set dataentry to no when you open the form for that mode.
    You also open the form for the required data, and not just open it without specifying criteria.
    Look at OpenArgs or filter for a form.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You don't say HOW you are opening the input form, but you could have 2 buttons that would open the form in different modes:

    One button ("btnAdd"), would have the following code that opens the form in "ADD" mode:
    Code:
    Private Sub btnAdd_Click()
    'The user can add new records but can't edit existing records.
        DoCmd.OpenForm "InputFormName", , , , acFormAdd
    End Sub

    The other button ("btnEdit"), would open the form in EDIT/Add/Delete mode:
    Code:
    Private Sub btnEdit_Click()
    'The user can edit existing records and add/delete records.
        DoCmd.OpenForm "InputFormName", , , , acFormEdit
    End Sub

    Change "InputFormName" to the actual form name.

  9. #9
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,821
    Hi Wade

    Can you give us a screenshot of your Relationship window showing all the fields in your Client table?

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

Similar Threads

  1. Input data validation of Form
    By dcmphi in forum Programming
    Replies: 2
    Last Post: 09-30-2016, 08:15 AM
  2. Replies: 1
    Last Post: 06-03-2016, 08:23 PM
  3. Replies: 6
    Last Post: 04-04-2015, 08:10 AM
  4. Replies: 3
    Last Post: 10-23-2012, 09:04 AM
  5. Sub form data input
    By ghard123 in forum Forms
    Replies: 2
    Last Post: 04-15-2012, 04:47 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