Viewing duplicate entry

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #16
    change line 4 of your code to this:

    Dim lngFilter As Integer


    If the above does not work, change line 4 to this:

    Dim lngFilter As Variant

    Comment

    • ashenton
      New Member
      • Oct 2008
      • 24

      #17
      I tried the first change and got the same type mismatch error as before.

      When I tried the second change I got another 2498 error in

      Code:
      DoCmd.OpenForm Me, , , lngFilter
      :(

      Comment

      • puppydogbuddy
        Recognized Expert Top Contributor
        • May 2007
        • 1923

        #18
        Ok, I did some research to get the proper syntax. This should work.
        Code:
        Private Sub DAMS_Number_AfterUpdate()  
          
        Dim tmpID As Long  
        Dim strFilter As String  
          
        tmpID = Nz(DLookup("[DAMS Number]", "DAMS Stock", "[DAMS Number]=" & Me!DAMS_Number), 0)  
        If tmpID <> 0 Then  
        MsgBox "This DAMS asset already exists in the database", vbOKOnly  
        strFilter = "[DAMS Number] = " & tmpID  
        DoCmd.OpenForm Me, , , strFilter  
        End If  
          
        End Sub
        _______________ _______________ _______________ _____________

        If you still get a type mismatch and the data type for [DAMS NUMBER] is integer, change this line:

        Dim tmpID As Long

        To this:

        Dim tmpID As Integer

        Comment

        • ashenton
          New Member
          • Oct 2008
          • 24

          #19
          Hi again,

          Sorry for the late reply, I been off sick.

          I tried the code. With 'tmpID As Long' I get the same 2498 error. When I change the line to Integer I get a nic error!

          Run-time error '6'

          Overflow


          Any ideas? lol

          Comment

          • ashenton
            New Member
            • Oct 2008
            • 24

            #20
            Hi again,

            Sorry for the late reply, I been off sick.

            I tried the code. With 'tmpID As Long' I get the same 2498 error. When I change the line to Integer I get a nic error!

            Run-time error '6'

            Overflow


            VB shows the error in line

            Code:
            tmpID = Nz(DLookup("[DAMS Number]", "DAMS Stock", "[DAMS Number]=" & Me!DAMS_Number), 0)
            Any ideas? lol

            Comment

            • ashenton
              New Member
              • Oct 2008
              • 24

              #21
              By the way, the DAMS Number field in the table is set to text.

              Comment

              • puppydogbuddy
                Recognized Expert Top Contributor
                • May 2007
                • 1923

                #22
                Originally posted by ashenton
                By the way, the DAMS Number field in the table is set to text.
                Hope you are feeling better. If the DAMS number is text, that changes everything.
                Code:
                Private Sub DAMS_Number_AfterUpdate()   
                  
                Dim tmpID As Long
                Dim strDams As String   
                Dim strFilter As String   
                
                  
                tmpID = Nz(DLookup("[DAMS Number]", "DAMS Stock", "[DAMS Number]=" & Me!DAMS_Number), 0)   
                If tmpID <> 0 Then   
                strDams = Me!DAMS_Number
                MsgBox "This DAMS asset already exists in the database", vbOKOnly   
                strFilter = "[DAMS Number] = '" & strDams & "'"   
                DoCmd.OpenForm Me, , , strFilter   
                End If  
                End Sub
                If the above does not work, change this:
                Dim strDams As String

                To:
                Dim strDams As Variant

                Comment

                • ashenton
                  New Member
                  • Oct 2008
                  • 24

                  #23
                  Nope, that doesn't work either. It comes up with another 2498 error which VB attributes to

                  Code:
                  DoCmd.OpenForm Me, , , strFilter
                  :(

                  Comment

                  • puppydogbuddy
                    Recognized Expert Top Contributor
                    • May 2007
                    • 1923

                    #24
                    Rather than go back and forth, could you attach a test copy of your database in Access version 2000 format so I can look at it?

                    Comment

                    • ashenton
                      New Member
                      • Oct 2008
                      • 24

                      #25
                      Hi,

                      I don't seem to be able to attach anything. There is no browse button at the bottom of the message edit box :(

                      Comment

                      • puppydogbuddy
                        Recognized Expert Top Contributor
                        • May 2007
                        • 1923

                        #26
                        Originally posted by ashenton
                        Hi,

                        I don't seem to be able to attach anything. There is no browse button at the bottom of the message edit box :(
                        Hi,

                        Immediately after you submit your post, bring it back up on the screen. If you look at the bottom of the screen, click on the word "edit", and you will be in the message editor. Enter "attachment " as the reason for editing your post, then go to the bottom of your screen. There you will see a button for managing attachments. Click it and you will see a browse button and an upload button. Click the browse button to select the file, then click the upload button.

                        Comment

                        • ashenton
                          New Member
                          • Oct 2008
                          • 24

                          #27
                          I've found where you mean now, thanks for that :)

                          I'll have to do the upload from home as it's been blocked by the corporate network lol
                          Last edited by ashenton; Oct 29 '08, 05:46 PM. Reason: attachment

                          Comment

                          • ashenton
                            New Member
                            • Oct 2008
                            • 24

                            #28
                            Here is the attachment, sorry it's taken so long!
                            Attached Files
                            Last edited by ashenton; Nov 13 '08, 01:28 PM. Reason: Attachment

                            Comment

                            • puppydogbuddy
                              Recognized Expert Top Contributor
                              • May 2007
                              • 1923

                              #29
                              Got your file. Am out of the office. Will get back to you on or before Monday.

                              Comment

                              • ashenton
                                New Member
                                • Oct 2008
                                • 24

                                #30
                                Thank you very much :)

                                Comment

                                Working...