Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2005
    Location
    New England
    Posts
    35

    Unanswered: Data entry form issue

    I have a form with a subform that is used before medical appointments. I'm trying to get it so that when the form is opened, the subform automatically goes to a new record. I tried setting the subforms data entry property to yes, however than I had printing issues when I clicked on the command button that I use to print the current record. I suspect it has to do with data entry, and am now looking to see if there is another way to open a subform to a blank record when it's opened. I don't neccessarily care if the other records are hidden or not. Thanks for any help. I'm using Access 2003

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Look up GoToRecord in help.

  3. #3
    Join Date
    Aug 2005
    Location
    New England
    Posts
    35
    Thanks, I knew there was something but couldn't remember what it was to search for.

  4. #4
    Join Date
    Aug 2005
    Location
    New England
    Posts
    35
    okay, sorry again. I have tried everything I can think of and can't seem to figure out how to get DoCmd.GoToRecord to work. It just says that the object isn't open. I've tried running it in OnLoad and OnOpen. I also added a DoCmd.OpenForm line prior to the GoToRecord all to no avail. I'm sure it's something simple, I just can't seem to think of it right now. Thanks for all the help.

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    New record in subform

    Could you:

    In the OnOpen event (or OnLoad event) of the mainform, do this:

    Forms!MyMainForm!MySubForm.setfocus
    DoCmd.GoToRecord , , acNewRec
    Forms!MyMainForm!SomeFieldName.setfocus
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    New Record in subform

    After thinking about it a bit and the error you wrote, I'm wondering if you don't have some other events firing before the subform is loaded (the error seems to indicate that the subform is not even opened to issue the docmd.gotorecord,,acnewrec). Are you manually coding in setting the sourceobject of the subform?
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Aug 2005
    Location
    New England
    Posts
    35
    I got it. It was one of those "duh" moments. I was using DoCmd.GoToRecord,"Form Name",acNewRec I took out the form name and it was fine.

Posting Permissions

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