Consulting

Results 1 to 4 of 4

Thread: Form to run query

  1. #1
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location

    Form to run query

    It's been a while since I did any Access so looking for basic assistance here.
    The StatusQuery form is to allow a user to get any combination of Status values (0, 1, 2 or 3) from the ContractDetails table.
    1 - Is this the right approach?
    2 - If so, can you spot the problem?

  2. #2
    BoardCoder VBAX Regular
    Joined
    May 2004
    Location
    Istanbul, Turkiye
    Posts
    73
    Quote Originally Posted by mdmackillop
    It's been a while since I did any Access so looking for basic assistance here.
    The StatusQuery form is to allow a user to get any combination of Status values (0, 1, 2 or 3) from the ContractDetails table.
    1 - Is this the right approach?
    2 - If so, can you spot the problem?
    Hi,

    I edited my post to remove completely wrong approach so it wouldn't take place anymore . Sorry, if you read it before I delete it.

    I was wrong. I thought that Status values are supposed to be stored as combination of totals of selections. Now I see that it is supposed to retrieve different Status valued records...


    However;
    In your database, in MakeSQL function, following line has a syntax error :

    TotVal = MtVal0 + MyVal1 + MyVal2 + MyVal3

    MtVal0 should be MyVal0.

    Also DoCmd.RunSQL SQL wouldn't work for SELECT queries, so it will create the correct SQL string that you would need but you should assign this SQL string as Record Source to another form (for example a subform in this main form) to retrieve & display queried records.

    I attached a modified version of your DB by using my suggestiong above.

    Suat

  3. #3
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Suat,
    Thanks for that. It answers my query and I can use the subform approach easily in my project.
    Regards
    Malcolm

  4. #4
    BoardCoder VBAX Regular
    Joined
    May 2004
    Location
    Istanbul, Turkiye
    Posts
    73
    Quote Originally Posted by mdmackillop
    Hi Suat,
    Thanks for that. It answers my query and I can use the subform approach easily in my project.
    Regards
    Malcolm
    Glad to hear it helps, Malcolm!

    Suat

Posting Permissions

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