Consulting

Results 1 to 2 of 2

Thread: Data exchange with a query

  1. #1
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    204
    Location

    Data exchange with a query

    How (can) I
    1. Use a user-written function as part of the criteria in a select query? I.E,
    The function might return the value of a variable.

    2. Obtain the data from such a query...or at least finding out if the query found a matching field...without viewing the query

    I hack around this by using a FORM based on the query. I can test a field in the form for NULL or "". But Cannot use a variable in the query's criterion field.

  2. #2
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    1. Just use the function in the query as you would any other criteria

    SELECT *
    FROM MyTable
    WHERE MyField = MyFunction();

    2. You could use the DLookup() domain aggregate function or, if you are into code, use either a DAO or ADO solution to open the recordset and get the value of whatever field you want.

Posting Permissions

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