Results 1 to 4 of 4

Thread: VB Code - Runtime error

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    2

    Exclamation VB Code - Runtime error

    I am a newbie here and did not know where to post this question.

    I am having a runtime error in a program I wrote a few years ago and now I get runtime error #13 - type mismatch.

    Here is the code the debugger sent me to and I have placed **'s next to the line that is highlighted in the debugger.

    Can anyone help? This has been running for 3 years without a hitch and no one has editted the code.

    -----------

    Private Sub cmd_Completed_Click()
    Dim AlternateID As Variant

    txt_SvcDescription.SetFocus
    DoCmd.OpenForm "frm2_WorkOrderStatus"
    ** Forms![frm2_WorkOrderStatus]!lbl_IssuedTo.Caption = Me!IssuedTo
    If Not IsNull(Me!PMSpec) Then AlternateID = DLookup("AlternateEmployeeID", "tbl_PmSpecifications", "[ID] = " & [PMSpec])
    If Not IsNull(Me!CalSpec) Then AlternateID = DLookup("AlternateEmployeeID", "tbl_CalibrationSpecifications", "[ID] = " & [CalSpec])
    If AlternateID > 0 Then
    Forms![frm2_WorkOrderStatus].lbl_Alternate.Caption = DLookup("FirstNameLastName", "qry_EmployeeNames", "[Employee_Number] = " & [AlternateID])
    Else
    Forms![frm2_WorkOrderStatus].chk_Alternate.Enabled = False
    End If
    End Sub

    ----------

    Thank you very much in advance fir your help.

    Sincerely

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: VB Code - Runtime error

    This doesn't look like VB. Is it in Access VBA?
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    2

    Re: VB Code - Runtime error

    Yes it is an old Access VB program. Sorry for not indenting I do know better I am just going crazy trying to find the problem.
    Thanks for the reply.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: VB Code - Runtime error

    At a glance, it looks as if the data in Me!IssuedTo isn't something you can set a caption to. Single step to that line, then see what Me!IssuedTo is.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

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



Click Here to Expand Forum to Full Width