Results 1 to 6 of 6
  1. #1
    mjdemaris is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Location
    Washington State
    Posts
    12

    Docmd.browseto where condition

    Hi all.



    I have a Nav form (Main), with a subform (Parts) which also has a subform datasheet, (PartDS). I have a button (Discontinued) that uses the browseto command in a macro to show all the discontinued parts in the DS. Another one switches this back to all parts.

    I need to add another that allows me to see which parts are in locations 1, 2 or 3. In this case, PIT is one location. I've tried using a macro as before, then I went to VBA. Both of them give me a pop up dialog box that says: Enter Parameter Value ? And under that: PIT, and a textbox for input.
    If I type in the text, I get what I want. But why is this happening? I just added the location field (Warehouse) today to add in this functionality for the Parts Manager.

    Thanks,

    Mike.
    Last edited by mjdemaris; 01-28-2016 at 06:39 PM. Reason: more info

  2. #2
    mjdemaris is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Location
    Washington State
    Posts
    12
    Well, I haven't got it to work yet. I've tried using:

    "[table].[field] = " & "PIT"
    "[field] = " & "PIT"
    "'PIT'"
    and others.

    i've also tried using a string variable: strArea = "PIT"
    "[table].[field] = " & strArea

    but I still get the box.

    It seems like a simple text/string criteria should work!

  3. #3
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    If you just use [field] instead of [table].[field] and you have multiple tables involved. Access may ask you to specify the parameter value of it when you execute the query. Can you make a query that returns all inventory for all locations? then you could use that query to drive data and filter that data accordingly.

  4. #4
    mjdemaris is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Location
    Washington State
    Posts
    12
    Well, I am using a query as the source object of the subform control. I want to be able to view all inventory, and filter down to specific storage areas (such as PIT), view discontinued items, and then change the data so the manager can check the latest quantity on hand and make adjustments to the quantities, if someone just grabbed a bunch of parts without signing them out.

    The problem I ran into is that a query using Totals cannot be updated, so trying to use a calculation in the datasheet query and allowing the manager to change data does not work, yet.

    So, I decided to use multiple datasheets and queries instead of just one, to see if this would help. And I still have that problem of filtering the DS down.

    The code for this is:

    Code:
    Me.DS.SourceObject = "F-AllPartsDS"
        DoCmd.BrowseTo acBrowseToForm, "F-AllPartsDS", "F-Main.NavigationSubform>F-Parts.DS", "[T-Bins].[Warehouse] = " & areaSelect, , acFormEdit
    Thanks

  5. #5
    mjdemaris is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Location
    Washington State
    Posts
    12
    Also, how would I filter a query as you suggest, and still allow it to show all inventory?

  6. #6
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Create the query as you would normally, a select query. Then for the column you wish to filter you can enter a object reference to field which has you wish. like
    Select * from tblTables where tblTables.myField = [forms]![frmBossForm].form!FieldName

    then the query can run and pull in the values from that field.

    There are other ways using vba that you can also use parameters but may not give you what you want.
    Last edited by Perceptus; 02-16-2016 at 03:33 PM. Reason: apparently the word query was typed as filter. lol.

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

Similar Threads

  1. BrowseTo isnt available now HELP!
    By fluffyvampirekitten in forum Access
    Replies: 1
    Last Post: 11-17-2015, 11:04 AM
  2. Replies: 8
    Last Post: 06-19-2014, 04:20 PM
  3. docmd.open form between dates condition
    By Ruegen in forum Programming
    Replies: 6
    Last Post: 09-22-2013, 11:23 PM
  4. DoCmd.OpenReport WHERE condition
    By bidbud68 in forum Programming
    Replies: 16
    Last Post: 10-19-2012, 05:31 AM
  5. DoCmd OpenReport ... where condition with a Like
    By Grooz13 in forum Programming
    Replies: 4
    Last Post: 08-31-2010, 09:04 AM

Tags for this Thread

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