Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Open subform that has the current record of calling form at opening


18 May 2013   #1

Windows 7 Home Premium 64bit
 
 
Open subform that has the current record of calling form at opening

I though this would be simple but searches have not worked. here is my code from the caling form:

Private Sub BD_stuff_Click()
On Error GoTo Err_BD_stuff_Click
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = CurrentRecord
stDocName = "RFIsBD_stuff"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_BD_stuff_Click:
Exit Sub
Err_BD_stuff_Click:
MsgBox Err.Description
Resume Exit_BD_stuff_Click
End Sub

I thought defining the "stLinkCriteria" would work but it did not. I've tried severa other things from on line searches but nothing has worked the subform always is opened to the 1st record.


My System SpecsSystem Spec
.

22 May 2013   #2

Windows 7 x64
 
 

I don't understand the context for this question. Searching this forum, from your hard drive, from an application?
My System SpecsSystem Spec
22 May 2013   #3

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Quote   Quote: Originally Posted by Silvera View Post
I though this would be simple but searches have not worked. here is my code from the caling form:

Private Sub BD_stuff_Click()
On Error GoTo Err_BD_stuff_Click
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = CurrentRecord
stDocName = "RFIsBD_stuff"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_BD_stuff_Click:
Exit Sub
Err_BD_stuff_Click:
MsgBox Err.Description
Resume Exit_BD_stuff_Click
End Sub

I thought defining the "stLinkCriteria" would work but it did not. I've tried severa other things from on line searches but nothing has worked the subform always is opened to the 1st record.
This is all about ms access isn't it? Line "Resume Exit_BD_stuff_Click" can be removed....totally useless.
It's not a subform at all! It's just a new form you open from a routine (most liekly a button click). The problem is stLinkCriteria. What do you want to accomplish with: stLinkCriteria = CurrentRecord?
CurrentRecord is a property of the form so should be programmed as Me.CurrentRecord. But what do you want to do with current record number?
My System SpecsSystem Spec
.


22 May 2013   #4

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

My System SpecsSystem Spec
22 May 2013   #5

Windows 7 Home Premium 64bit
 
 

You are correct. I posted it on an access forum but did not get a response. Glad you knew what I was talking about. I have since realized that is was not a sub form but a supplemental [yes separate] form, I added new fields to track a new situation so I created this form to manipulate the new data. A friend also a part-time programer for his job we are both architects. He manages the firm and I the construction administration of project being built. He suggested I define stLinkCriteria, I probable misunderstood what he was telling.

Yes I use a label as a button to call the new form. I want it to open at the same record as the one that is calling the new one. I've been self teaching myself data base programing since the mid 80' and do not do it enough to remember all I have learned. I will try it out later this afternoon to see if I can make it work. Thank you very much for responding to me cry for help!!!
My System SpecsSystem Spec
22 May 2013   #6

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

What do you mean by saying "same record"? Has the record a primary key? Is recordsource on called form the same as calling form?
My System SpecsSystem Spec
Reply

 Open subform that has the current record of calling form at opening




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:17 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33