Results 1 to 6 of 6
  1. #1
    DaneTrain24 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    13

    Search Form Results Change When I Click On Them

    Whenever I click on one of the cells in my search form and then click on another cell, the 1st cell changes to whatever text in located in the 2nd cell. The cells revert back to their proper text when I clear the search. I also notice that the first cell in the form is always highlighted when I clear the search or open the form for the first time. I'm not sure if this is related to my cell copying issue.

    Note that this ONLY happens if I am selecting a 2nd cell in the same column has the 1st cell.

    My code is below.

    Option Compare Database




    Private Sub Command662_Click()
    Dim strsearch As String
    Dim strTextsearch As String
    strText = Me.TxtSearch.Value
    strsearch = "SELECT * from ProcurementDatabase where ([SKU #] like ""*" & strText & "*"") or (Supplier like ""*" & strText & "*"") or ([Item Type] like ""*" & strText & "*"") or (Model like ""*" & strText & "*"") or (Property like ""*" & strText & "*"")"
    Me.RecordSource = strsearch
    End Sub


    Private Sub TxtSearch_AfterUpdate()
    Call Command662_Click
    End Sub
    Last edited by DaneTrain24; 02-03-2016 at 02:08 PM. Reason: Add info

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    struggling to visualise the problem.

    you refer to cells - I presume you mean controls

    you say you have more cells, but your code only refers to one of them

    Are your cells/controls bound? they shouldn't be

    Property is a reserved word, using it as a field or table name can cause problems - recommend you change it to something else. If you can't change it, at least use square brackets which works 99.9% of the time

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Aside from the issues pointed out by Ajax, you also are not using Option Explicit (not a good idea) and have not declared strText, so it is a Variant data type. Not that it is causing your issue, but it's the sort of thing that gives you problems sooner or later. There is probably other control code involved in the problem, which you haven't divulged. Nor do I get what you mean by a cell "in the same column" even if I take it to mean control.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    DaneTrain24 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    13
    Click image for larger version. 

Name:	Test.jpg 
Views:	8 
Size:	109.3 KB 
ID:	23575Click image for larger version. 

Name:	Test2.jpg 
Views:	8 
Size:	103.9 KB 
ID:	23576

    Please see above images. This is pulling from an excel spreadsheet, so I was referring to the cells it is pulling from. The first picture is the form immediately after I hit the search button. You can see in the second picture once I click on the "cell" in Column Model, Row 2, it changes to the information in the "cell" above it.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    OK. Cell is not part of the db terminology, per se. We do interchange field/colum sometimes and row/record but cells is not really part of the vernacular. It is assumed that when we say we click on a field, it's taken to be at the intersection of a row and column. On to the problem:
    Does this happen on all the records or just the one you've shown? If you click on the first model field record in your post and hold left mouse and drag back to the start or end, do you find the mystery text or other unseen text in there? It might actually be there, but your option to control display behaviour might be set in a way that causes two different renderings. One when the form is rendered, another when you click on the field. If the answer is no for both, I have no other clue at present. You could zip and attach a copy of your db, but I can't open most versions higher than 2007, so you'd have to create a 2007 version or post your 2010 version and others may jump in to help.
    Last edited by Micron; 02-04-2016 at 02:04 PM. Reason: spelling

  6. #6
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    Further to Micron's comments - what happens if you click on one of the other controls (lets get the terminology right) in row 2? does that also change to the same as the row above? Or only the first row? ar all rows above?

    A few other things to confirm

    a) this is a continuous form type form (it looks like it is but just to check)
    b) the various controls are bound to the fields from the Excel linked table
    c) you are aware that you cannot edit data in excel from Access - thinking of how you have set the form allow edits/add new properties (both should be set to No) and the recordset type (try setting to snapshot) for the form
    d) you have put square brackets around 'property' in your query or changed the name

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

Similar Threads

  1. Search Form Query Results
    By armyofdux in forum Queries
    Replies: 5
    Last Post: 03-20-2015, 12:24 PM
  2. Opening records via Double-Click event on a search form.
    By IncidentalProgrammer in forum Programming
    Replies: 4
    Last Post: 11-21-2014, 03:47 PM
  3. Replies: 3
    Last Post: 09-02-2013, 04:33 PM
  4. Search form getting wrong results
    By Ruegen in forum Programming
    Replies: 1
    Last Post: 08-22-2013, 06:32 PM
  5. Replies: 5
    Last Post: 01-03-2013, 01:38 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