Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2009
    Posts
    5

    Question Unanswered: Please help with this code!

    I am having a problem with some code and I'm getting a Run-time error 13 "Type Mismatch" This database is for clients and such, and the button that gets this error is the one where I would like to "Discharge" a selected person out of the program.

    I am no good at access as you can probably tell. This is the code where it stops and the stars indicate the line it gets stuck at in the debugger. Im not sure what needs to be added or taken away.
    -----------------------------------------------------------------------
    Private Sub Command9_Click()
    Dim thisClient As Object

    Set thisClient = New Client
    thisClient.ClientId = Me.id

    thisClient.Discharge Me.Dischage_date, "Discharged", Me.DischargeReason, Me.Discharge_Disposition ****
    DoCmd.Close
    -------------------------------------------------------------------------

    If this is not that clear, my apologies, If I didn't provide enough info then tell me some more info you might need. A picture is attached as well.

    Thank you in advance.

    - Jeff
    Attached Thumbnails Attached Thumbnails database.JPG  

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what object is:thisClient.Discharge
    what do you think
    Code:
    thisClient.Discharge Me.Dischage_date, "Discharged", Me.DischargeReason, Me.Discharge_Disposition ****
    should be doing?

    type mismatch (usually) means you are attempting to assign the wrong datatype to a column or control.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Looks to me like your predecessor wrote a bespoke client class and this code is calling a method of that class. I am afraid this is bad news for you going forward - this person was more sophisticated a programmer than the average Access developer. You should explain to your boss that maintaining and developing this database will likely be a steep learning curve.

    You should look for a code module (specifically a class) called "Client" and find a sub called "Discharge" and post the first few lines of this.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    In fact, much easier than browsing around - right click the line "thisClient.Discharge ...." and select "Definition"
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2009
    Posts
    5
    When I select definition for the "thisClient.Discharge" line and select definition, it highlights 3 lines up the words "thisClient" are selected. Thats all it does.

    Today I tried a copy of this database saved elsewhere, and when I click on discharge, it gets "run-time error 424" "Object required" instead of Run-time error 13.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    In that case, please right click on the bold bit below and select definition:
    Code:
    Set thisClient = New Client
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Mar 2009
    Posts
    5
    ok, once I do that, it says" identifier under cursor is not recognized"

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    In the VBA window, please can you tick Tools -> References and list everything ticked?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Mar 2009
    Posts
    5
    I dont know if its me or what but references is grayed out.

  10. #10
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Are you able to upload what you have? Make sure there is no data in of course. Or at least, could you send a screen shot of "greyed out" references box? New one on me, that.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  11. #11
    Join Date
    Mar 2009
    Posts
    5
    I can't even get into the references from tools, its greyed out on the intial dropdown when you click tools. I have a Access guru coming in later today to try and fix it, but if he cant ill be back on here.
    Ill post again though to tell what he found and stuff. Thanks for trying to help pootle flump, and healdem, its greatly appreciated!!

Posting Permissions

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