Solved

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

Posted on 2011-03-16
11
320 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

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…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

724 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