Results 1 to 4 of 4

Thread: Help with class module

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    15

    Help with class module

    I am rather new to the programming arena, so please excuse the elementary nature of my question(s). In the query below, the class module returns the required fields for a specific item. The ultimate goal for this query is to return any records from the items that have a null value in a required field.

    rsfields.Open "SELECT * FROM " & lvItem _
    & " WHERE IsNull (" & cla1.GetORISFieldsList(lvItem.Text) & ")", _
    cnWS, adOpenStatic, adLockReadOnly

    I know the class module is working properly, but I think my ordering may be incorrect. I am getting the following error message: "Wrong number of arguments used with function in query expression...)

    Any tips and/or suggestions would be greatly appreciated.

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Help with class module

    Welcome to the Forum

    IsNUll in SQL expects two arguments. And in this senario I think you should be checking whether the field is Null or Not and IsNull is not the one to use. Your Query should be like this
    VB Code:
    1. rsfields.Open "SELECT * FROM " & lvItem _
    2. & " WHERE " & cla1.GetORISFieldsList(lvItem.Text) & " Is Null", _
    3. cnWS, adOpenStatic, adLockReadOnly
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    15

    Re: Help with class module

    Thanks for the tip. However, this query results with a message box saying there is a syntax error (comma) in the query expression.

  4. #4
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Help with class module

    Put a break point at rsFields.Open statement and before executing print the SQL Query in the immediate window. Then analyze the query and see what is wrong.

    What is the present in these two
    lvItem
    cla1.GetORISFieldsList(lvItem.Text)
    Use [code] source code here[/code] tags when you post source code.

    My Articles

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