-
Oct 31st, 2000, 04:42 AM
#1
Thread Starter
Addicted Member
Hi
How can i move to a particular record in a database when i select a data inside a combobox?
Thanks in advance!
-
Oct 31st, 2000, 04:59 AM
#2
New Member
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
-
Oct 31st, 2000, 05:01 AM
#3
Fanatic Member
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...
-
Oct 31st, 2000, 06:31 AM
#4
Thread Starter
Addicted Member
Thanks for the reply guys
But does the Recordsetclone works in vb6?
By the way i am using a databound to connect to Access
-
Oct 31st, 2000, 08:56 AM
#5
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|