473,505 Members | 13,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Show specific record from subform to another Form

Access 2003

I have an unbound search form, which shows filtered search records in
it’s sub-form.

On the unbound search form I wish to place a button, which will close
off the search form, and take me to my main document form, showing the
selected record indicated in the initial search forms, sub-form.

Using option one below, placed on any-one of the search forms, sub-
form fields, On-double click event, will easily take me to the
specific record on my main document form.

However, I would prefer to use a button on my main search form to
perform this. I tried several variations of option 2, but I can’t
seem to get it right.

Any help would be appreciated.

Dave

Main Document form: frmDocuments
Main Search Form: frmSearch – subform: fsubSearchForm
Main Document ID: DocID
Option One
______________________________________
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmDocuments"

stLinkCriteria = "[DocID]=" & Me![DocID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmSearch"
______________________________________
Option Two
______________________________________
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmDocuments"

'stLinkCriteria = "[DocID]=" & Me![DocID]
stLinkCriteria = "[fsubSearchForm].Form![DocID] =" & Me!Forms!
[frmDocuments]![DocID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmSearch"
______________________________________
Jun 27 '08 #1
2 2387
While you can do it in one step, I prefer the the two part solution.

Place a control on the search form called txtDocID. Make it's control
source fsubSearchForm].Form![DocID]

In option one change to stLinkCriteria = "[DocID]=" & Me![txtDocID]

Add the error control for a null selection in the subform. Make
txtDocID visible for testing and hide it in production.

It's worked well for me for almost 15 years (old habits die hard)

Tim Mills-Groninger

On Jun 6, 9:28*am, Dave <david.bry...@gmail.comwrote:
Access 2003

I have an unbound search form, which shows filtered search records in
it’s sub-form.

On the unbound search form I wish to place a button, which will close
off the search form, and take me to my main document form, showing the
selected record indicated in the initial search forms, sub-form.

Using option one below, placed on any-one of the search forms, sub-
form fields, On-double click event, will easily take me to the
specific record on my main document form.

However, I would prefer to use a button on my main search form to
perform this. *I tried several variations of option 2, but I can’t
seem to get it right.

Any help would be appreciated.

Dave

Main Document form: * * frmDocuments
Main Search Form: * * * frmSearch – subform: fsubSearchForm
Main Document ID: * * * DocID

Option One
______________________________________
* Dim stDocName * * * * * As String
* Dim stLinkCriteria * * *As String

* stDocName = "frmDocuments"

* stLinkCriteria = "[DocID]=" & Me![DocID]
* DoCmd.OpenForm stDocName, , , stLinkCriteria
* DoCmd.Close acForm, "frmSearch"
______________________________________

Option Two
______________________________________
* Dim stDocName * * * * * As String
* Dim stLinkCriteria * * *As String

* stDocName = "frmDocuments"

* 'stLinkCriteria = "[DocID]=" & Me![DocID]
* stLinkCriteria = "[fsubSearchForm].Form![DocID] =" & Me!Forms!
[frmDocuments]![DocID]
* DoCmd.OpenForm stDocName, , , stLinkCriteria
* DoCmd.Close acForm, "frmSearch"
______________________________________
Jun 27 '08 #2
Tim, Thank you!

That was extremely easy to implement, and worked great!

Cheers,
Dave

On Jun 6, 3:14 pm, timmg <tmillsgronin...@gmail.comwrote:
While you can do it in one step, I prefer the the two part solution.

Place a control on the search form called txtDocID. Make it's control
source fsubSearchForm].Form![DocID]

In option one change to stLinkCriteria = "[DocID]=" & Me![txtDocID]

Add the error control for a null selection in the subform. Make
txtDocID visible for testing and hide it in production.

It's worked well for me for almost 15 years (old habits die hard)

Tim Mills-Groninger
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4732
by: William Wisnieski | last post by:
Hello Everyone, Access 2000, I have a main unbound form with a bound datasheet subform . The subform is bound to a query that returns records based on criteria in the main form. The user...
4
2618
by: news.online.no | last post by:
In a query, I need too be able to show if a parent record has a child record. Using the query in a combo box too select record in a form. Thanks :)
2
2223
by: John Baker | last post by:
Hi: I have a sub form which i would like to show all the records selected from a table. There may well be over 100 of them. For reasons I cant fathom, the form will only show six, and then...
5
3361
by: Bob | last post by:
Hi Everybody I have a form called frmListBox that is connected to a table tblListBox. This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder" and...
5
5221
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
3
3198
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data....
2
11253
by: nkoske | last post by:
I have a form with a subform in datasheet view and I have a event on one of the fields in the subform, so that the user can double click it and go to expanded information based on that field. ...
1
2129
by: sjvandevoorde | last post by:
I need some help with a couple forms/test fields. Bare with me I have been out of the field for some time and only consider myself an intermediate user. The first one is a subfrom which lists...
1
1653
by: asavu | last post by:
Hello, I'm somewhat new to this, and I definately need some help. I have a db for a small business, and I have a main form, Customer Info, which has a subform Appliance Info, which has a subform...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.