Solved

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

Posted on 2011-03-16
11
305 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now