Results 1 to 2 of 2
  1. #1
    byterbit is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Location
    Noou Yauk
    Posts
    32

    Like"*" passed in a function to show all records

    I have a function in a module ( a very simple one that works well :

    Function GetMyVariable()


    GetMyVariable = VCODE
    End Function

    )
    that I use to pass parameters into queries .
    Typically vcode would carry a "code" to show a fraction of records. In the query itself the criteria reads: GetMyVariable()


    I now need to tell the query to show ALL records , and I pass in: Like"*"
    It blows up, shows no records !

  2. #2
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    Well if you think:

    say you have a code '00001'
    the function and query i guess would say:

    SELECT *
    FROM TableA
    WHERE code = VCODE (Is basically saying '00001' = 'Like"*"')

    That's not going to work as '00001' is not equal to 'like "*"'. This is my guess as to the issue.
    I'd recommend you show everyone the whole query including SQL code etc so we can have a look.

    Personnally i'd change your function/query to allow for null values.


    If VCODE != null
    Do Something
    else
    Do nothing

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access 2003 Date() Function returns "#Name?"
    By smartel@soprema.ca in forum Programming
    Replies: 5
    Last Post: 01-18-2012, 05:52 AM
  2. Replies: 4
    Last Post: 10-18-2010, 09:44 PM
  3. Replies: 3
    Last Post: 04-10-2010, 10:22 AM
  4. Replies: 4
    Last Post: 02-11-2010, 02:21 AM
  5. Fields do not show in "Form View"
    By hawzmolly in forum Forms
    Replies: 4
    Last Post: 01-09-2010, 06:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums