Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Quote Originally Posted by moke123 View Post
    Open the QBE and dont select any tables. Then click on the SQL view and paste the code into it. Run it and your done.
    As moke mentioned I just created an adhoc query.



    However you still need to fix the issue, else you will be running that query all the time?
    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

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    BTW I was just using your DB for testing something and I spotted this for add new record?
    Code:
    Private Sub btnAddNew_Click()
    On Error GoTo btnAddNew_Click_Err
    
        On Error Resume Next
        DoCmd.GoToRecord , "", acNewRec
        Me.DhrNum.SetFocus
        If (MacroError <> 0) Then
            Beep
            MsgBox MacroError.Description, vbOKOnly, ""
        End If
    
    
    btnAddNew_Click_Exit:
        Exit Sub
    
    btnAddNew_Click_Err:
        MsgBox Error$
        Resume btnAddNew_Click_Exit
    
    End Sub
    AFAIK you would need to check Err.Number not macroerror if using vba ?
    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. #18
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    Welshgasman,

    Thanks for spotting that, I am not very VB literate and If I add a button with the wizard I then usually convert them to VB which Access does when you ask it to and apparently it leaves the MacroError in there.

    I do have to become more VB Literate, I could never have spotted that.

    Thanks

    Dave

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Quote Originally Posted by Dave14867 View Post
    Welshgasman,

    Thanks for spotting that, I am not very VB literate and If I add a button with the wizard I then usually convert them to VB which Access does when you ask it to and apparently it leaves the MacroError in there.

    I do have to become more VB Literate, I could never have spotted that.

    Thanks

    Dave
    Also each On Error supercedes the previous statement?, so you would not get to Click_Err
    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

  5. #20
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    One would think that Access would do a better job of converting the Macros.

    Many thanks for you assistance, it worked like a charm.

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

Similar Threads

  1. Replies: 8
    Last Post: 04-17-2018, 05:17 PM
  2. Simple calculation won't work
    By wcrimi in forum Queries
    Replies: 5
    Last Post: 11-27-2015, 03:47 PM
  3. Listbox will work when multiselect=simple
    By ro88y09 in forum Forms
    Replies: 3
    Last Post: 02-25-2015, 11:10 AM
  4. Replies: 4
    Last Post: 05-25-2014, 02:01 AM
  5. Replies: 2
    Last Post: 02-22-2012, 07:14 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