Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-16
11
Medium Priority
?
324 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

636 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