Results 1 to 4 of 4
  1. #1
    Xonos is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    15

    Toggle Button Stuck (New Record rather than specified filter.)

    Access 2010 64bit



    Hello everyone, long-time reader of the forums - first time poster. I have an issue with the Access "Toggle Filter Button" being ticked whenever I open a form from a listbox (dbl click). Let me give you a bit of information regarding my setup...

    [tblOrders] - (Key) [ID] - [Date] - [Consignee] (Text) - [OrderComplete] (Yes/No)
    [tblPurchaseOrders] - (Key) [ID] - (Key) [AssignedID] - [ProductName] - [Weight]

    This is just an example and it is not exactly what my database looks like however it allows me to explain easier. tblOrders and tblPurchaseOrders are related One-to-Many ( tblOrders.[ID]->tblPurchaseOrders.[AssignedID]).

    Anyways, I have a listbox on my primary form that lists tblOrders by ID, Date, Consignee and OrderComplete. When I first built the form and I bound the listbox to column 0 ([ID]) and created the event on double-click which the code looked like this:

    Code:
    Private Sub listOrders_DblClick(Cancel As Integer)
        Dim stDocName As String
        Dim stLinkCriteria As String
        Dim intLinkID As String
    
            intLinkID = Me.tblOrders.Value
            stLinkCriteria = "[ID] = " & intLinkID
            Debug.Print stLinkCriteria
        stDocName = "frmManageOrders"
        DoCmd.OpenForm stDocName, , , stLinkCriteria
    
    Exit_Command23_Click:
        Exit Sub
    
    End Sub
    Now, for whatever reason - either something I've changed or a bug somewhere... when I double-click the list item, it opens as a new record rather than the corresponding record. I noticed that the "Toggle Filter" button on the access ribbon was ticked so I unchecked it and it immediately switched to the proper record. Why does this happen and what (if common) changes can make this appear or work this way? I am a novice with Access and I am still learning VBA. I struggle with not knowing parameters by heart, although the syntax seems to be similar to other languages I've worked with.

    I can post the database however I'd rather keep it somewhat confidential if possible considering the magnitude of data I've collected is sought after by people in this industry. I'd be willing to pay for advice also if necessary. I don't want anyone to hold my hand and write code for me but aid in giving me hints to what I should look for.

    Thank you everyone for making this my favorite forum of reference.


    EDIT: Figured it out - I had somehow enabled "Data Entry" which is located on the Property Sheet of a Form under the "Data" tab. Apparently this mode removes your ability to actually filter values properly and is intended for what you'd assume it means - Data Entry.


    Duh.... /sigh
    Last edited by Xonos; 02-23-2012 at 02:45 PM. Reason: Solved!

  2. #2
    Xonos is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    15
    Ok, so I was reading some other threads and read that toggling the filter on and off again will fix the issue I am having. So I added the following code to the targeted form.

    Code:
    Private Sub Form_Load()
        Me.FilterOn = False
        Me.FilterOn = True
    End Sub
    This seems to have resolved my issue HOWEVER, I don't like it - this cannot be a proper solution to this considering I never had to do it before. I am willing to bet other issues will reveal themselves by this action. Does anyone have insight on this? I would not consider it solved personally even though it works.

  3. #3
    Xonos is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    15
    And my first issue has arrived. I made a Wizard-Created Button to create a new record through a form - and because it's unfiltered, it just takes me to the first record. -_- Any ideas?

  4. #4
    irish634 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    48
    I had this exact problem... although my resolution was entirely different.

    I had imported data into a table then deleted the data because I didn't like it or something.
    So I imported again BUT... I did not compact the database to reset the auto number.
    This is a key point because I imported 30 records, so my record id/auto number started at 31 and not 1

    Every time I double-clicked from the list box, my second form would be filtered on a new record since the list value didn't match the record Id number in the table.

    I do not know why this happened this way, but I reset my record id (auto number ) field and everything started working normally again.


    EDIT:
    What I wrote above didn't fix it either.

    It only worked that way if the recordID matched the listvalue
    Since the list value starts at 0, they will never match.

    So my solution was to use this as my criteria:
    Code:
    sLinkCriteria = "RecordID=" & Me!lstbx_BookList.Column(0, lstbx_BookList.RowSource)
    Instead of this (which I used to use in Acc2003):
    Code:
    sLinkCriteria = "RecordID=" & Me!lstbx_BookList.Value

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

Similar Threads

  1. How to create a datasheet toggle button
    By tobydobo in forum Access
    Replies: 7
    Last Post: 02-06-2012, 01:12 PM
  2. Toggle Filter on and off
    By Paul H in forum Forms
    Replies: 1
    Last Post: 09-14-2011, 05:54 PM
  3. Making a toggle button hide a text box.
    By RemonKoybito in forum Forms
    Replies: 3
    Last Post: 05-20-2011, 11:34 AM
  4. Toggle Button on Bound Form
    By P5C768 in forum Forms
    Replies: 7
    Last Post: 12-30-2010, 03:00 PM
  5. Toggle Button Options
    By Matthieu in forum Forms
    Replies: 2
    Last Post: 11-23-2009, 04:05 PM

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