Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Click a record in the datasheet and the corresponding record in...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sc - 19 Mar 2005 16:49 GMT
I am trying to write codes that when a user clicks a record in a datasheet in
a subform, and the matching record will pop up.  

I will appreciate anyone who can give me a hand.

Best regards

SC
Damiaan - 19 Mar 2005 18:53 GMT
Your datasheet is based on a form.
In the form you can trigger the oncurrent event.

In the on-current event place your code. Something like:

docmd.openform "myform",,,"id-field=" & me.idfield
Marshall Barton - 19 Mar 2005 19:10 GMT
>I am trying to write codes that when a user clicks a record in a datasheet in
>a subform, and the matching record will pop up.  

You'll need to use some VBA code in the subform's Current
event.

If you want to open another form to the same record in the
datasheet subform:

On Error Resume Next
DoCmd.Close acForm, "otherform"
On Error GoTo ????
DoCmd.OpenForm "otherform", , ,"keyfield=" & Me!keyfield

If you want the main form to navigate to the same record:

With Me.Parent.RecordsetClone
    .FindFirst "keyfield=" & Me!keyfield
    If Not .Nomatch Then
        Me.Parent.Bookmark = .Bookmark
    End If
End With

Signature

Marsh
MVP [MS Access]

Dennis - 21 Mar 2005 15:33 GMT
If the datasheet and the form are the same then all you need to do is place
the following in the Form_Click event

RunCommand acCmdSubformFormView

> I am trying to write codes that when a user clicks a record in a datasheet in
> a subform, and the matching record will pop up.  
[quoted text clipped - 4 lines]
>
> SC
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.