Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 12th, 2005, 02:42 PM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Click event on a subform

HI, I'm new to VBA programming and am trying to see if there is a way to click on a record in a subform and have it retrieve it into the main form.

example is i have a main form and a subform built of a reworkno field. I want to be able to click on that record in the subform and have have pull it into the current form.

I really appreciate any and all help i can get on this.

Thanks Clayton
 
Old December 12th, 2005, 05:48 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just for clarification, your example is something like a work order containing a field that references the record of the work order documenting any additional work done?

 
Old December 12th, 2005, 06:09 PM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes that it. I actually figured it out using the following code

Private Sub Doneby_Click()
With Me.Parent.RecordsetClone
      'Assuming the search value is a string
    .FindFirst "[Doneby] = '" & Me![Doneby] & "'"
      If Not .NoMatch Then
        Me.Parent.Bookmark = .Bookmark
    End If
End With

End Sub


Quote:
quote:Originally posted by kindler
 Just for clarification, your example is something like a work order containing a field that references the record of the work order documenting any additional work done?

Clayton
 
Old December 14th, 2005, 05:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Note that you seem to have your form/subform relationship BACKWARDS.

Typically, one selects something from the MAIN form and the SUBFORM updates, not the other way around. If you do it right, the main and subforms will have parent/child link fields properties that automatically reset the subform once the main form goes from one record to the next.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandBarButton Click Event iprovalo Excel VBA 2 April 16th, 2008 02:52 AM
DataGrid click event Clive Astley Beginning VB 6 0 July 4th, 2005 12:44 AM
Click Event dkr72 C# 3 December 8th, 2004 06:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.