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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datasheet View to Form view 1

Status
Not open for further replies.

mymou

Technical User
May 21, 2001
355
GB


Hi All

This must be real easy.

I want to double click on a record in a subform datasheet and have the view change from datasheet to form view.

This is just a normal right click operation - but I can figure out how to code it. Help.


Stew
 
I didn't realise you could do that.

I would suggest you use a click event to call RunCommand (was DoMenuItem)to call the menu option fo this. Datasheet view is on the View Menu when the form is displayed. mike.stephens@bnpparibas.com
 


Hi BNPMike

I think this will just effect the main form - and not the subform - that's what it does from the menu. Any other ideas?

Stew
 
On your subform properties choose Datasheet as the Default View and be sure that you have 'Yes' on Record Selectors. Use the following code on the Double Click event of the subform:

DoCmd.OpenForm "formname", acNormal, , filterfield = Me!filterfield

When you double click on the record selector for a specific record on the subform, it displays in form view for the record selected.
 

Hi kstearns04

This was the solution that I have ended up using - but it doesn't solve my original question.

This solution opens up the form separetely (like a pop up) and not in the position of the subform (like right click, subform datasheet).

Thanks anyway.


Stew
 
Suggestion...

Create another form with default view of FormView and filtered to desired record, and on double-clicking change the subform, that is displayed.

In code, use the name of the subform control and change it's Source object property

SubForm.SourceObject="NameOfYourFormInFormView"
 


Hi blavuma


Nice but sneaky.

This certainly does the trick - at the expence of one extra form.


Stew

 
this code will switch views if you have views allowed on the subform set to 2

Me.SubFormname.SetFocus
DoCmd.RunCommand acCmdSubformDatasheet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top