Finding record on main form

A

Alex

Hi all, one final issue and then my project is complete - thanks to everyone
who has offered help and advice of past three weeks.

I'm in a subform, linked to the mainform by a field [RecordId]. By clicking
on a button, I pick up the value of the subform record field [LicenceeId]

I then need to find and display the record in the main form, where
[RecordId] = [Licenceeid]

i have been using the following code:

Lid = [LicenceeId]
MsgBox Lid (to check that I am getting the right value)
Dim rs As Object

Forms!frmOrganisations!CID.SetFocus (this sets focus to the mainform - not
sure if this is necessary?)
Set rs = Me.Recordset.Clone
rs.FindFirst "[RecordId] = " & Lid
Me.Bookmark = rs.Bookmark

Thanks for any help

Alex
 
S

SFAxess

Alex,
You can do this (if it is an Access Project, this won't
work right):

Dim Lid as Long 'I assume it is a number??? Otherwise
this code won't work

Lid = me.LicenseId 'use the name of the form control

me.Parent.Form.RecordsetClone.FindFirst "[RecordID]=" &
Lid
me.Parent.Form.Bookmark =
me.Parent.Form.RecordsetClone.Bookmark

I hope that helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top