• Command Button Wizard

    Author
    Topic
    #480240

    Using the Command Button Wizard, and to find specific data, I am running into an absence of fields issue (see image). The form the command button is to be used in is a continuous form, and the one it “calls” is a single form; both are based on the same query. I’ve never seen this before, so I reverted to writing the code myself as a double-click event, but got a file type mismatch error upon running; but, like I said, both are based in the same query. I’m baffled. Any help, as always, is much appreciated. :confused:

    29520-11-29-2011-10-19-53-AM

    Viewing 1 reply thread
    Author
    Replies
    • #1308451

      We need more information. Can you show us the code you have written. What fields are you using? What type are they?
      The fact that both forms use the same query should not make any difference.

      When you say a “file type mismatch” do you mean a “data type mismatch”?

      Have you created fields using the Lookup wizard perhaps? It does a good job of hiding the real data type of fields and so causing confusion sometimes.

      • #1308461

        Ooops, yes, that’s “data” and not “file” type mismatch John. The Data Type is AutoNumber Long Integer (it is the record ID number). The Lookup Wizard was used for three combo boxes when the table was built (all text format). Here’s the code:

        Code:
        Private Sub Provider_DblClick(Cancel As Integer)
        On Error GoTo ErrHandler
        
        
            Dim stDocName As String
            Dim stLinkCriteria As String
        
        
            stDocName = “Frm_Event_EOB”
            
            stLinkCriteria = “[ID]=” & “‘” & Me![ID] & “‘”
            DoCmd.OpenForm stDocName, , , stLinkCriteria
        
        
        ExitErrHandler:
            Exit Sub
        
        
        ErrHandler:
            MsgBox Err.Description
            Resume ExitErrHandler
        
        
        End Sub
        

        29526-11-29-2011-1-30-27-PM

        • #1308482

          Try the following:

          stLinkCriteria = “[ID]=” & Me![ID]

          • #1308487

            Geez . . . .
            That did it Patt :clapping:

            Dare I ask why (and why the wizard didn’t work either)? In any case, thanks so much for this solution!!

    • #1308504

      No idea about the wizard problem.

      Were you asking why the single quotes were removed to make it work, if so, the single or double quotes are used for text fields not numeric fields.

    Viewing 1 reply thread
    Reply To: Command Button Wizard

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: