?
Solved

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

Posted on 2011-03-16
11
Medium Priority
?
321 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

800 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