Solved

Open a form by dbl clicking or edit button on subform record

Posted on 2011-03-16
11
318 Views
Last Modified: 2013-11-27
I have a main "frmVendorlist" that has just button controls New, Edit, Delete and a subform "frmVendInqSubform" that displays the records. I want to be able to open the form that edits these records"frmVendorDetail"  with the form filled in with the record data Name, Address, Phone, ETC  based  the vendor name "txtMFG_NAME" on the edit form "frmVendorDetail" and "MFG_NAME"  on"frmVendInqSubform"  subform , by either dbl clicking into the record  or by selecting the record and clicking the edit button. any help would be greatly appreciated as This project just got thrown in my lap and little time to complete it.
0
Comment
Question by:skull52
  • 6
  • 5
11 Comments
 

Author Comment

by:skull52
ID: 35151622
I have tried this  
Private Sub MFG_NAME_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmVendorDetail", acNormal, , "MFG_NAME=" & Forms!frmVendorlist.frmVendInqSubform.Forms!MFG_NAME
End Sub

but no go.
0
 
LVL 28

Expert Comment

by:omgang
ID: 35152345
DoCmd.OpenFrom "frmVendorDetail", acNormal, , "MFG_NAME=" & Chr(34) & Me.MFG_NAME & Chr(34)

The recordsource in the edit form is the same as the recordsource in the current subform correct?  Since your executing the command from the subform itself you can use the Me keyword to refer to any of the controls on the subform.  Since the criteria expression is a text value we must wrap it in quotes hence the Chr(34).  We could also have done
DoCmd.OpenFrom "frmVendorDetail", acNormal, , "MFG_NAME='" & Me.MFG_NAME & "'"
but it reads much better the first way (particularly when you're old and can't see so much anymore....like me)

OM Gang
0
 

Author Comment

by:skull52
ID: 35152391
OMgang,
that opened the form but I would like it to open the form with the selected records data populated in the form for editing. I also relate to the old and can't see :-)
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 28

Expert Comment

by:omgang
ID: 35156414
Any chance you can post a copy of your Access db?  Only need to post some representative data and make sure no confidential information.
OM Gang
0
 

Author Comment

by:skull52
ID: 35157105
Yes, but I have decided to use a continuous form as opposed to a sub form. I will include both. The way I was using the subform and main form was to use the main form for buttons New, Edit, Delete and the subform "frmVendInqSubform" to displays the records, there was no master child links so the subform would display all the records and not just the ones linked to the main form. I could not get it to re-query the sub form after entering data from the enter/edit form but it works with "frmVendorListC" form. Now if I can get the enter/edit form to open to the selected record with all the data by dbl clicking on the the record  or clicking  edit button on "frmVendorListC"  EETest.accdb
0
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 35157961
skull52, the problem isn't on the frmVendorListC form, it's on the frmVendorDetail form.  You have the following for the forms Load event

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
txtMFG_NAME.SetFocus
End Sub

This says, regardless of waht the calling procedure is passing, open the form to a new record.  Comment out the GoToRecord command and it works how you want.
OM Gang
0
 

Author Comment

by:skull52
ID: 35158909
OM Gang
Well how stupid am I, Thanks that worked.
0
 
LVL 28

Expert Comment

by:omgang
ID: 35158962
Often times a second set of eyes is all that's required.
OM Gang
0
 

Author Comment

by:skull52
ID: 35159027
I thought you couldn't see anymore ;-)
0
 
LVL 28

Expert Comment

by:omgang
ID: 35159057
That's the scary part!  The blind leading the blind!
OM Gang
0
 

Author Comment

by:skull52
ID: 35159096
Ain't it the truth, thanks again.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question