Results 1 to 5 of 5
  1. #1
    teirrah1995 is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    35

    Add new record to other form.

    I'm sure the answer is here, but I don't know what to search for.

    I have an object on form A. When it is clicked, this happens.

    Private Sub Command1_Click()

    DoCmd.GoToRecord , , acNewRec

    End Sub

    I want the new record not to be on the current form, but on form B. I feel a bit daft as I'm sure the answer is simple.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if you look at the help that pops up when you type in

    docmd.gotorecord

    The first option is what type of object it is (in your case acdataform)
    the second option is what is the object name (in this case your form_b)

    so you would have something like

    DoCmd.GoToRecord acDataForm, "Form_B", acNewRec

  3. #3
    teirrah1995 is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    35
    Thanks for the reply
    I tried this, and it told me off because "The object "Patient" (Form B) isn't open". I opened Patient and tried again, and got the same message.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    is the form open when you try to go to a new record?

    if not you have to open it first.

    Without knowing what your code says I can't tell you what the problem is.

  5. #5
    teirrah1995 is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Sep 2010
    Posts
    35
    That works, thanks. I've told it to open my form before adding a new patient.

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

Similar Threads

  1. If record does not exist, open add new record form
    By RobertIngles in forum Programming
    Replies: 2
    Last Post: 02-01-2011, 08:47 AM
  2. Duplicate last record to next record in form
    By jdhaldane in forum Forms
    Replies: 4
    Last Post: 12-17-2010, 04:22 PM
  3. Replies: 0
    Last Post: 05-04-2010, 06:39 AM
  4. Replies: 3
    Last Post: 06-27-2009, 03:53 PM
  5. Replies: 9
    Last Post: 03-24-2009, 09:19 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