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

Silvera

New member
Local time
1:45 PM
Messages
16
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 Computer My Computer

At a glance

Windows 7 Home Premium 64bitAMD Phenom II X6 1075T 3.0GHz4 GB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home built
OS
Windows 7 Home Premium 64bit
CPU
AMD Phenom II X6 1075T 3.0GHz
Motherboard
ASUS M4A88T-M
Memory
4 GB
I don't understand the context for this question. Searching this forum, from your hard drive, from an application?
 

My Computer My Computer

At a glance

Windows 10 x64Intel i5-3570KCrucial 16GBnVidia Geforce 660 GTX
Computer type
PC/Desktop
OS
Windows 10 x64
CPU
Intel i5-3570K
Motherboard
Asus Maximus V Gene
Memory
Crucial 16GB
Graphics Card(s)
nVidia Geforce 660 GTX
Sound Card
onboard
Monitor(s) Displays
NEC 2490WUXi2
Screen Resolution
1920x1200
Hard Drives
Crucial M4 256GB
PSU
Corsair 650TX
Case
Fractal Design - Define Mini
Keyboard
Filco Majestouch Tenkeyless Black MX
Mouse
Logitech MBJ58
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 Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bits 7601...Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz4,00 GBATI Mobility Radeon HD 5400 Series
Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bits 7601...Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz4,00 GBATI Mobility Radeon HD 5400 Series
Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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 Computer My Computer

At a glance

Windows 7 Home Premium 64bitAMD Phenom II X6 1075T 3.0GHz4 GB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home built
OS
Windows 7 Home Premium 64bit
CPU
AMD Phenom II X6 1075T 3.0GHz
Motherboard
ASUS M4A88T-M
Memory
4 GB
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 Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bits 7601...Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz4,00 GBATI Mobility Radeon HD 5400 Series
Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
Back
Top