Results 1 to 5 of 5
  1. #1
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149

    Cannot goto a new record after printing a report

    Below is coding when saving an invoice.
    If chkPrintInvoice is checked, then print invoice.
    Finally it moves to a new record.

    Code:
    If Me.chkPrintInvoice = True Then
       DoCmd.OpenReport "rptInvoice", acViewPreview, , "InvNo='" & Me.InvNo & "'"
    End If
    DoCmd.RunCommand acCmdRecordsGoToNew

    If not print invoice, it can go to a new record.


    But when it print, it shows an error 2046 : The Command or action 'RecordsGoToNew' isn't available now.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Set focus to a control on the form first.?
    https://answers.microsoft.com/en-us/...4-f58db527f78c
    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
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by uoghk View Post
    Below is coding when saving an invoice.
    If chkPrintInvoice is checked, then print invoice.
    Finally it moves to a new record.

    Code:
    If Me.chkPrintInvoice = True Then
       DoCmd.OpenReport "rptInvoice", acViewPreview, , "InvNo='" & Me.InvNo & "'"
    End If
    DoCmd.RunCommand acCmdRecordsGoToNew

    If not print invoice, it can go to a new record.
    But when it print, it shows an error 2046 : The Command or action 'RecordsGoToNew' isn't available now.
    Which event is your current code in
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    The code is inside a Save button.
    It performs 3 things:
    1. save current record
    2. print invoice if requested
    3. goto a new record for input

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by uoghk View Post
    The code is inside a Save button.
    It performs 3 things:
    1. save current record
    2. print invoice if requested
    3. goto a new record for input
    can you post a copy of the db
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Report printing a single record
    By gebmiller1984 in forum Access
    Replies: 5
    Last Post: 01-15-2015, 03:47 PM
  2. Printing a record in a report programatically
    By argsemapp in forum Reports
    Replies: 3
    Last Post: 12-03-2013, 05:40 PM
  3. Printing a single record in a report
    By kelann in forum Reports
    Replies: 28
    Last Post: 10-04-2012, 10:07 AM
  4. Printing report from first record works...
    By TinaCa in forum Programming
    Replies: 10
    Last Post: 01-17-2012, 10:59 AM
  5. Replies: 0
    Last Post: 05-25-2011, 06:13 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