Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2008
    Posts
    150

    Unanswered: Help modify a Macro Where Statement

    Hello,

    I am using Access 2010 and I am not liking it so far.

    Can someone please help me adjust this macro?

    ="[Proj_Num]=" & [Proj_Num]

    I have a button that on click, a pop-up form appeas with the Proj_Num filtered with specific data. This method works fine, now I would like to modify the "Where" statement ="[Proj_Num]=" & [Proj_Num] to also filter by another field (Tech).

    Appreciate any help. Thank you.

  2. #2
    Join Date
    Nov 2011
    Posts
    413
    If you already have a popup form that opens with the matching Proj_Num then just add the Tech field to the form, or is the Popup form unbound?
    Access 2010 will grow on you, give it time.

  3. #3
    Join Date
    Sep 2008
    Posts
    150
    Hi Burrina,

    Thank you for your resonse. The popup form is bound to a query. I do have the tech field in the query. Right now, the button filters the proj num, which is perfect. I would also like the macro to filter by tech as well. So, when the user clicks on the button, a popup dialog form will appear with the proj number AND the tech name. Right now, the form filters displays all of the proj numbers linked to the form, but displays ALL of the techs that worked on that project.
    Do you know how I can adjust this Where statement: <="[Proj_Num]=" & [Proj_Num]> to include the Tech name? :-)

  4. #4
    Join Date
    Nov 2011
    Posts
    413

    Help modify a Macro Where Statement

    What is the purpose of this popup form? It does not have to be bound by the way. Get away from Macros, what you can do in VBA is always better. If the popup form was bound to the same record source as your main form, then simple binding it by your Primary Key will be sufficient. Is the is popup form data being duplicated, shown twice? Is this what you are after, if not can you post a sample copy of your db, minus all confidential data,compiled and zipped.

    HTH
    Attached Thumbnails Attached Thumbnails PopupForm.png  

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    lets assume your control (probably a combo or list box) is called TechResource and the column is called Tech, and its a numeric value
    then
    ="[Proj_Num]=" & [Proj_Num] & " AND TECH = " & TechResource

    if Tech as a string / text / char value then you'd need to delimit the valkeu suign speech or quote marks
    ="[Proj_Num]=" & [Proj_Num] & " AND TECH = '" & TechResource & "'"

    its hard to say whether that will do the job as there is stuff all detail to give a full answer
    infact what youprobably shouldbe doing is using a pair of linked combo/list boxes

    first one contains projects, user selects project, in the combo's on click event then fill the tech combo box relevent for that specific project
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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