Record Selecting

dbprogman

Registered User.
Local time
Tomorrow, 06:54
Joined
Mar 29, 2005
Messages
35
Situation:

I have form with two (2) datasheet subforms data1, data2 both subforms are based on the same table but different fields. The reason for this is that the company commissioning this database dont want to have to scroll across to view fields.

Problem:

The problem I am having is that I need some code that will allow a record to be selected (highlighted) in data2 when the corrosponding record has been selected in data1 and visa versa.

So far I have come up with the following code but it doesn't seem to work.

Dim rs As Object
On Error GoTo Form_Current_Error
Set rs = [data2].RecordsetClone
rs.FindFirst "[fileID] = " & Me.fileID
If Not rs.EOF Then [data2].Bookmark = rs.Bookmark
'
On Error GoTo 0
Exit Sub
Form_Current_Error:

Exit Sub

In advance thanks for your help and hopefully a solution is possible.
 
would something like this work...

in the OnCurrent event of sub form Data1..

dim id_d1 as long
id_d1 = me.fileID

Forms![YourMainForm].SubFormData2.form.SetFocus
DoCmd.FindRecord id_d1

hth,
..bob
 
Thanks that worked , however would it be possible to have the record selected without shifting focus to data2?

May have been a little premature it kind of works, generates error about moving focus if you choose end then it works.
 
Last edited:
Not sure of what else is going on in your code but...
I have no idea what you mean by "choosing end".
try shifting focus as needed. ( including after doing the find )
hth,
..bob
 

Users who are viewing this thread

Back
Top Bottom