Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Form - How do I move Main Form record pointer

Status
Not open for further replies.

DAmoss

Technical User
Jul 23, 2003
169
GB
Hi,

I've created a popup subform that contains a couple of my main forms data fields, when i click on a given subform record I am able to store the RecordID chosen, but what I want to do is move my main form record pointer to the same chosen subform record.

Basically I'm creating a popup search form, but I am struggling to get it to work, can anyone help point me in the direction? What am I doing wrong or is there a simpler way to achieve what I'm after?

I have the following code in my subform which I have been playing with to try and make it work, vCompanyRecNum is a public long declared in a module by the way, I use this to store the chosen RecordID


vCompanyRecNum = [RecordID]

Forms!frmCompanies!CompName.SetFocus
Me.RecordsetClone.FindFirst "[RecordID] = " & vCompanyRecNum
Me.Bookmark = Me.RecordsetClone.Bookmark

Forms!CompanyFinder!RecordID.SetFocus


Thank you in advance
 
Ahh ... its ok I've solved it myself, just added the following code to my subform and it's working perfectly now: it now moves the to main record when i select it in the subform.


Dim strCriteria As String

vCompanyRecNum = [RecordID]
strCriteria = "[RecordID] =" & vCompanyRecNum

Forms!frmCompanies.RecordsetClone.FindFirst strCriteria
Forms!frmCompanies.Bookmark = Forms!frmCompanies.RecordsetClone.Bookmark
 
Why not simply this ?
Code:
Forms!frmCompanies.Recordset.FindFirst "RecordID=" & [RecordID]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top