Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153

    Find and Edit Form - How to make it so it doesn't show a record when the form is opened?

    I have a "Find & Edit" form that i use to search for records and make edits.

    However every time i open this form, it shows data from a previously entered record. and this confuses some of the users. How can I get this form to show up with NO RECORDS at all. Id like it so that have to search for a record then make the changes then click the "SAVE RECORD" button, then that record goes away.



    I am not big into SQL so is there a NON-SQL way to accomplish this?

    If need be I can try to use SQL..
    Any help would be greatly appreciated

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In the OnOpen event of the form, go to a new record. This can be done in a macro or in VBA.

    VBA:
    DoCmd.GoToRecord,,,acNewRec

  3. #3
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Quote Originally Posted by aytee111 View Post
    In the OnOpen event of the form, go to a new record. This can be done in a macro or in VBA.

    VBA:
    DoCmd.GoToRecord,,,acNewRec
    I copied and pasted that into the code builder under On Open Event. It did not work. it just showed a different record than before.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    My bad, too many commas. DoCmd.GoToRecord , , acNewRec

  5. #5
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Quote Originally Posted by aytee111 View Post
    My bad, too many commas. DoCmd.GoToRecord , , acNewRec
    now i get an error, says:

    'Run-Time error 2105 You cant go to the specified record"

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    That means that you have Allow Additions set to No, or else your query record source does not allow additions.

    Try:
    Me.Filter="PKfieldname=0"
    Me.FilterOn=true

  7. #7
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Quote Originally Posted by aytee111 View Post
    That means that you have Allow Additions set to No, or else your query record source does not allow additions.

    Try:
    Me.Filter="PKfieldname=0"
    Me.FilterOn=true
    SO i can copy and paste that code into the on open event?

  8. #8
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Quote Originally Posted by KingOf206 View Post
    SO i can copy and paste that code into the on open event?
    WHen i copy the code into VBA... I get a 'Enter parameter Value" box

  9. #9
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The field name you entered isn't correct - it needs to match the primary key in your record source.

    What I am trying here is setting a filter on the form that is nonsensical, and hoping that you won't get an error. If you filter on an invalid value then the form should show blank. Change the field name in the filter line.

  10. #10
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Quote Originally Posted by aytee111 View Post
    The field name you entered isn't correct - it needs to match the primary key in your record source.

    What I am trying here is setting a filter on the form that is nonsensical, and hoping that you won't get an error. If you filter on an invalid value then the form should show blank. Change the field name in the filter line.
    Ok so i have changed the name, its now:

    Me.Filter="Group_ID=0"
    Me.FilterOn=true


    The next probelem is that my form shows up as a blank form, it only has a title but all the fields are gone.missing ! lol

  11. #11
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Drat!

    Make it a subform. You say it is a "Find & Edit" form - put the "find" on an unbound main form and link this field to the subform. Then, on form open, the "find" box will be empty and therefor no records will show in the subform.

  12. #12
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Quote Originally Posted by aytee111 View Post
    Drat!

    Make it a subform. You say it is a "Find & Edit" form - put the "find" on an unbound main form and link this field to the subform. Then, on form open, the "find" box will be empty and therefor no records will show in the subform.
    Sorry ya lost me...

    Here is a copy of the DB, when it opens, it opens the main menu, then clcik on "Find and Edit Groups". THen the form'Frm_SearchByTray" will appear. This is the form i want to show up with NO RECORDS showing..

    Vicki-Signature Verification_August_2017.zip

  13. #13
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You have your Allow Additions property set to No - this is what is causing the error in post # 5. I presume that this is by design, that new records are not allowed to be added to this table.

    I changed it to Yes and added the goto new record to the OnLoad macro and it worked as expected. However, if you do not allow new records to be added then code must be added to prevent this from happening. Let me know.

  14. #14
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    A word of warning: you have some fields with spaces in the names and some Access reserved symbols in some of your field names.
    In "Tbl_All Trays", there is a field named "Verified&ReadyForAudit". You should not have the ampersand in the field name.

    Notice in form "Frm_SearchByTray", the label for the "Verified&ReadyForAudit" field is "VerifiedReadyForAudit" (the R is underlined). Access uses the ampersand (&) as an accelerator key. Pressing <alt>R jumps directly to the field "Verified&ReadyForAudit".

    In the LABEL, if you want to display "Verified & Ready For Audit", you would double up the ampersand: "Verified && Ready For Audit". This would display as "Verified & Ready For Audit".


    There are also fields with names that include the hash (#). This is the symbol that Access uses to delimit dates.


    --------------------------------------------------------------
    Some suggestions:
    Use only letters and numbers (exception is the underscore) for object names.
    Do not use spaces, punctuation or special characters in object names.
    Do not use look up FIELDS, multi-value fields or calculated fields in tables.
    Do not begin object names with a number.

  15. #15
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Quote Originally Posted by aytee111 View Post
    You have your Allow Additions property set to No - this is what is causing the error in post # 5. I presume that this is by design, that new records are not allowed to be added to this table.

    I changed it to Yes and added the goto new record to the OnLoad macro and it worked as expected. However, if you do not allow new records to be added then code must be added to prevent this from happening. Let me know.
    does it work after you did that? did you reattach what you did to this thread somewhere?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 16
    Last Post: 02-13-2017, 09:29 PM
  2. Replies: 8
    Last Post: 09-15-2015, 11:34 AM
  3. Replies: 3
    Last Post: 11-15-2012, 06:59 PM
  4. Find A Record on a Certain form to edit
    By donnan33 in forum Access
    Replies: 1
    Last Post: 02-29-2012, 02:08 PM
  5. Replies: 2
    Last Post: 09-24-2009, 08:07 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