Results 1 to 4 of 4
  1. #1
    Lockrin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    52

    Error in Code

    Hello all

    I have a button which prints a report based on criteria. It was working perfectly yesterday and today it doesn't like it. It's giving me the following error: "Return without GoSub"

    The code I have is as follows:

    Private Sub PrintDWG_Click()

    On Error GoTo Err_PrintDWG_Click

    Dim rptRound1 As String
    Dim rptRound2 As String
    Dim rptRectL As String
    Dim rptRectW As String
    Dim rptFlatL As String
    Dim rptFlatR As String

    rptRound1 = "Drawing - Round (1 Seam)"
    rptRound2 = "Drawing - Round (2 Seam)"
    rptRectL = "Drawing - Rectangular (Length)"
    rptRectW = "Drawing - Rectangular (Width)"
    rptFlatL = "Drawing - Flat Oval (Length)"
    rptFlatR = "Drawing - Flat Oval (Radius)"

    If Me.Type = "Round" And Me.RoundSeam = "1 Seam" And Me.Released = "-1" Then
    DoCmd.OpenReport rptRound1, acViewPrint
    ElseIf Me.Type = "Round" And Me.RoundSeam = "2 Seam" And Me.Released = "-1" Then
    DoCmd.OpenReport rptRound2, acViewPrint
    ElseIf Me.Type = "Rectangular" And Me.RectSeam = "Length" And Me.Released = "-1" Then
    DoCmd.OpenReport rptRectL, acViewPrint
    ElseIf Me.Type = "Rectangular" And Me.RectSeam = "Width" And Me.Released = "-1" Then
    DoCmd.OpenReport rptRectW, acViewPrint
    ElseIf Me.Type = "Flat Oval" And Me.FlatOvalSeam = "Radius" And Me.Released = "-1" Then
    DoCmd.OpenReport rptFlatR, acViewPrint
    ElseIf Me.Type = "Flat Oval" And Me.FlatOvalSeam = "Length" And Me.Released = "-1" Then
    DoCmd.OpenReport rptFlatL, acViewPrint
    ElseIf Me.Released = "0" Then
    MsgBox "This Part has not been released!"
    Else
    End If

    Exit_PrintDWG_Click:
    Exit Sub



    Err_PrintDWG_Click:
    MsgBox Err.Description
    Resume Exit_PrintDWG_Click


    End Sub

    Any Ideas?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I don't see anything structurally wrong with the code. See it you have any bogus MISSING references.

  3. #3
    Lockrin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    52
    Hmmmn, I don't know what the problem was... I didn't change anything but it seems to be working alright, for now. If it crashes any more I will look into any missing references. Thanks for your help RuralGuy

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    An unhandled error can cause strange results on occasion. Checking for MISSING references just takes a second. http://www.accessmvp.com/djsteele/Ac...nceErrors.html

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

Similar Threads

  1. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 PM
  2. Help with VBA Code
    By access.newby in forum Forms
    Replies: 1
    Last Post: 11-15-2009, 05:43 AM
  3. Replies: 23
    Last Post: 03-26-2009, 06:50 PM
  4. Need help with code
    By hoenheim in forum Programming
    Replies: 9
    Last Post: 09-11-2008, 04: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