Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224

    Unanswered: run time error 2501

    I generate a list using select

    select workorders.workorderno, workorders.workorderid, workorders.workstatus

    when i double click the a row in the list it should open up the work order

    Private Sub List_DblClick(Cancel As Integer)
    DoCmd.openform "CurrWorkOrder", , , "[workorderno]=" & "'" & Me.List.Column(0) & "'"
    End Sub

    The problem I have is that if i have the criteria to workorderid or workstatus I get run - time error 2501
    So if i do
    DoCmd.openform "CurrWorkOrder", , , "[workorderid]=" & "'" & Me.List.Column(1) & "'"

    I get the error, could some one help me out
    if u need the complete code, lemme know n i will attach the file

    thank you

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by fullymooned
    I generate a list using select

    select workorders.workorderno, workorders.workorderid, workorders.workstatus

    when i double click the a row in the list it should open up the work order

    Private Sub List_DblClick(Cancel As Integer)
    DoCmd.openform "CurrWorkOrder", , , "[workorderno]=" & "'" & Me.List.Column(0) & "'"
    End Sub

    The problem I have is that if i have the criteria to workorderid or workstatus I get run - time error 2501
    So if i do
    DoCmd.openform "CurrWorkOrder", , , "[workorderid]=" & "'" & Me.List.Column(1) & "'"

    I get the error, could some one help me out
    if u need the complete code, lemme know n i will attach the file

    thank you
    Assuming you have the right types try:

    DoCmd.openform "CurrWorkOrder", , , "[workorderid]=" & "'" & Me.List.Column(1,List.ListIndex) & "'"

    Also, try putting in some trapping:

    If List.ListIndex < 0 then Exit Sub
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224
    i get the same error
    what do u mean by type here

  4. #4
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    He meant the data types. that is use quotes if the data type of workorderid is string ...

Posting Permissions

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