Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Location
    Madison, WI
    Posts
    10
    Provided Answers: 1

    Unanswered: Split DB, Front Form: Is there a way to specify loading of a default record?

    Running MS Access 2016, I have a database split into an Access db backend and .accde Front end. (Of course, I have an .accdb form that I edit and make changes on).

    IN this project, the front end opens on the first subject in one of the tables that is part of the database. However, I would like the database to open instead on no record/blank or on a fake patient/dummy patient established for this purpose.

    Any tips/tricks for working around this one?

    My one thought, really a hack, is to empty the db of data (retaining a backup), and then reimporting and appending the data that I want -- with a fake patient/dummy patient as the first subject.

    Is there a more delicate/code-like way to do this?

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    472
    Provided Answers: 22
    Yes, open the form to the record you want
    Docmd.openForm "frmMain",,,"[id]=99"

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    For a blank Record (new)...in the code window for that Form:
    Code:
    Private Sub Form_Load()
      DoCmd.GoToRecord , , acNewRec
    End Sub

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ranmans suggestion will try to open a row who's ID is 99, if thats your dummy record your'e good to go
    Missinglinqs suggestion will open and start the new row addition, if thsts ok then you are good to go

    another approach is to open the form and provide a row you know doesn't exist.... say
    Code:
    Docmd.openForm "frmMain",,,"[id]=-666"
    ...assuming that id is an autonumber column

    why consider that
    your approach means you have a dummy row, dummy data. that then needs reversing out of any queries used for reporting, it may need extra workin forms and reports. it relies on there being that specific row existing. if someone deletes it...
    missinglinq's approach starts the form to add a new record. if you are concerned baout sequential numbers you are creating a problem. grantred you shouldn't use a system generated number as a substitute for a contiguous list but some people do persist
    it means forcing the user to cancel the entry
    someone not knowing the application could indaverntantly add a new row

    ...granted these are semantics. if either approach works for you, run with them. its not what I'd do, but its not my application, either will work
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •