Results 1 to 5 of 5

Thread: Move to a record?

  1. #1

    Thread Starter
    Addicted Member CoMMiE's Avatar
    Join Date
    Jul 2000
    Location
    Malaysia, Kuala Lumpur
    Posts
    179

    Talking

    Hi
    How can i move to a particular record in a database when i select a data inside a combobox?


    Thanks in advance!

  2. #2
    New Member
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    8

    Thumbs up

    Hi!

    After selecting the data in the combobox,
    U can change the Criteria of your SQL query, using the combobox value.

    Hope this is ur requirement.

    smrenga


  3. #3
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008

    Use bookmarks

    Check out the Bookmarks topic in Access help and RecordsetClone.

    Basically you look up the bookmark of the item you have selected and then do a seek for that bookmark.

    If u need more, I will check in later.

    Cheers,

    Paul.

    P.S. Sorry I cannot give you the code - I just do not have time this a.m. I can do it later if you can wait.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  4. #4

    Thread Starter
    Addicted Member CoMMiE's Avatar
    Join Date
    Jul 2000
    Location
    Malaysia, Kuala Lumpur
    Posts
    179
    Thanks for the reply guys
    But does the Recordsetclone works in vb6?

    By the way i am using a databound to connect to Access

  5. #5
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008

    Cool Moving...

    You need to get at the recordset you are using for record display, use a find method to locate the record indicated in the Combo box and then use bookmarks to synchronise (The find method gives you access to the record but does not move the current position)

    You need something like the following...

    Code:
    Dim rst As Recordset
    Dim vBmark As Variant
    Dim strFind As String
    
    Set rst = Me.Data1.Recordset
    
    strFind = "Field='" & Trim$(Str(Me.Combo1.ItemData(ListIndex))) & "'"
    'NB I cannot remember how to get the data back from the ComboBox - this a'int it!!!
    
    'Do not include ' delimiters if the value is a number!
    'Check the ListIndex is <> -1
    
    rst.MoveFirst
    rst.FindFirst (strFind)
    
    If Not rst.NoMatch Then
      vBmark = rst.Bookmark
      Me.Data1.Recordset.Bookmark = vBmark
    Else
      MsgBox "Find failed!"
    End If
    The Combo Box cannot be bound, of course, set its data up in Form_Load or similar.

    Hope it helps.

    Paul

    P.S. There is no recordset clone but the Data1.Recordset has a clone property

    P.P.S. Ensure you are bound to a snapshot or a dynaset (Not a table) or it will not work.


    [Edited by paulw on 10-31-2000 at 09:04 AM]
    Not nearly so tired now...

    Haven't been around much so be gentle...

Posting Permissions

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



Click Here to Expand Forum to Full Width