Results 1 to 6 of 6
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Command Button Wizard

    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.

    11-29-2011 10-19-53 AM.jpg
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    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.
    Regards
    John



  3. #3
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts
    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
    11-29-2011 1-30-27 PM.jpg
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    Try the following:

    stLinkCriteria = "[ID]=" & Me![ID]

  5. The Following User Says Thank You to patt For This Useful Post:

    bfxtrfcmgr (2011-11-29)

  6. #5
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Geez . . . .
    That did it Patt

    Dare I ask why (and why the wizard didn't work either)? In any case, thanks so much for this solution!!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  7. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •