Results 1 to 5 of 5
  1. #1
    swavemeisterg is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    28

    Invalid or Unqualified Reference

    I have a form which allows users to select or input characteristics that then are entered into a table, and then click to move on to the next entry. I can't seem to get it to work right. When I try to run it, I get an error that says "Invalid or Unqualified Reference."
    It focuses on the section that says ![Specimen Type]
    Code:
     
    
    Private Sub NewBall_Click()
    DoCmd.GoToRecord , , acNewRec
    
    
    If SpecimenTypeCheck = True Then
    Me.SpecimenType = ![Specimen Type]
    Else
    Me.SpecimenType = ""
    End If
    
    
    If InputByCheck = True Then
    Me.InputBy = ![Input by]
    Else
    Me.InputBy = ""
    End If
    
    
    If MaterialCheck = True Then
    Me.Material = ![Material]
    Else
    Me.Material = ""
    End If
    
    
    If RecordingDateCheck = True Then
    Me.RecordingDate = ![Recording Date]
    Else
    Me.RecordingDate = ""
    End If
    
    
    If ProjectCheck = True Then
    Me.Project = ![Project Number]
    Else
    Me.Project = ""
    End If
    
    
    If MaterialCertCheck = True Then
    Me.MaterialCert = ![Material Cert]
    Else
    Me.MaterialCert = " "
    End If
    
    
    If VendorCheck = True Then
    Me.Vendor = ![Vendor]
    Else
    Me.Vendor = ""
    End If
    
    
    If BallDiaCheck = True Then
    Me.BallDia = ![Ball Diameter]
    Else
    Me.BallDia = ""
    End If
    
    
    If AvgHardHRCCheck = True Then
    Me.AvgHardHRC = ![Average Hardness HRC]
    Else
    Me.AvgHardHRC = ""
    End If
    
    
    If AvgRoughACheck = True Then
    Me.AvgRoughA = ![Average Roughness Side A (uin)]
    Else
    Me.[Average Roughness Side A (uin)] = ""
    End If
    
    
    If CaseDepthCheck = True Then
    Me.CaseDepth = ![Initial Case Depth (in)]
    Else
    Me.CaseDepth = ""
    End If
    
    
    If CoatThickCheck = True Then
    Me.CoatThick = ![Coating Thickness]
    Else
    Me.CoatThick = ""
    End If
    
    
    If CommentsCheck = True Then
    Me.Comments = ![Comments]
    Else
    Me.Comments = ""
    End If
    
    
    If Incriment_SN = True Then
    
    
    
    
    End Sub
    Any ideas?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Sure, you haven't told it where that value is coming from. The only time you could have that syntax is within a With block.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Here is a snippet of your code:
    Code:
    Private Sub NewBall_Click()
       DoCmd.GoToRecord , , acNewRec
    
    
       If SpecimenTypeCheck = True Then
          Me.SpecimenType = ![Specimen Type]
       Else
          Me.SpecimenType = ""
       End If
    The code in RED is referencing a field in a recordset - which you haven't declared or opened. Hence the error......

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Quote Originally Posted by ssanfu View Post
    The code in RED is referencing a field in a recordset - which you haven't declared or opened. Hence the error......
    To clarify, the code in red could be referencing a recordset. It could also be referencing a form field or control (not taking a position in the bang vs dot debate ).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I like the intellisense, so I don't use the bang when referencing a form field or control. But I see your dot.... uhhh... point.

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

Similar Threads

  1. Invalid or unqualified reference
    By mitchmcc in forum Access
    Replies: 3
    Last Post: 12-26-2011, 08:53 AM
  2. "Invalid Database Object Reference"
    By jgelpi16 in forum Queries
    Replies: 4
    Last Post: 06-28-2011, 06:39 AM
  3. invalid database object reference
    By survivo01 in forum Access
    Replies: 1
    Last Post: 06-02-2011, 04:02 PM
  4. Invalid database object reference.
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 04-11-2011, 02:48 PM
  5. docmd.openform Invalid database object reference
    By snoopy2003 in forum Programming
    Replies: 5
    Last Post: 03-15-2011, 09:11 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