473,734 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform Getting Parent's Current Record & VB Events....

Hi,
I have a form that is designed as a data sheet view. Attached to this
is a subform with some VB code. When the user clicks on a row, the
subform should pop up and run the VB code which accesses the record
corresponding to the row clicked.

To get this row, I tried using Me.Parent.Bookm ark. Unfortunately,
this gets the "Current Record" which is set via the navigation
buttons. While the user can click on the navigation buttons to get to
the "Current Record", it's very inconvenient to do so.

How can I use VB in a subform to get the record corresponding to the
row that was clicked to activate the aforementioned subform?

In addition, what subform event will run each time the "+" in a
datasheet view is clicked? I tried the Load, Connect, and half a
dozen other events, but they all only run the first time a subform is
invoked.
Thanks in Advance.
Nov 13 '05 #1
1 3732
> How can I use VB in a subform to get the record corresponding to the
row that was clicked to activate the aforementioned subform?

In addition, what subform event will run each time the "+" in a
datasheet view is clicked? I tried the Load, Connect, and half a
dozen other events, but they all only run the first time a subform is
invoked.
Responding to my own post here. After messing around with events, I
could not find a way to do either of the above, so instead I
implemented them manually and they appear to work.

Here's what I did:

1) I overrode the OnClick event of every data control in the datasheet
form. Each override did the same thing -- it spawned another form.
Any information to be communicated to the form was stored in a
temporary table.

2) I overrode the spawned form's Load event to pick up the data from
the table written in step 1.

3) I got rid of the "real" subforms.

This method works nicely because the user can click on any column and
still get the subform. On the other hand, on the first load the
subform pops up and trying to pop up multiple subforms doesn't quite
work as expected; ditto for scrolling on the datasheet. Both are
pretty minor irritations and I can live with them for now.


Thanks in Advance.

Nov 13 '05 #2

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

Similar topics

3
2979
by: DD | last post by:
I want to link a form to another form by a Cmd Button. CustomerID = CustomerID I want the form to open from the Cmd Button as if it was acting in the same way as subform What would be the code? as Access dose not show you. DD
25
10256
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
4
7017
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
0
1151
by: (Pete Cresswell) | last post by:
I've got a few subforms, each with an accellerator key assigned. When the user presses, for instance, Alt+2, the focus shifts to subform "2". This works OK once the user has selected a record on the form...then if they hop to another field and back to the form, they can navigate the subform via up/down arrow keys that respond to KeyDown events on the subform. The problem is just after the parent form has opened and the user has yet...
3
2498
by: matthewemiclea | last post by:
So I think this may be a stretch, but I have a subform that is displayed on a main form. The subform is based on a query that brings records from a table(It does not bring all fields, but the main identifiers, since there would be too many to be able to display). The user specifies criteria on the form, which narrows down the number of records shown in the subform. Underneath the subform, there is another subform that consists of 25...
2
2183
by: Bill Stock | last post by:
I have a subform which is causing a 3314 (Field can't contain a null value because required is set to True) error. I solved this problem by trapping it in the before update event. But then I started getting a "No Current Record" error. I wanted to see what err number was coming through, so I put a MsgBox in the subform's error event. But the MsgBox never came up and the error is now gone. Is the MsgBox pulling the focus away from the...
2
2241
by: John | last post by:
I have two tables in a 1:M relationship- the parent has 5 fields in the primary key and the child 6 (these are actually pretty far downstream in a complicated ER model, but the problem is between these two). I set up the relationship with no problem- referential integrity and left outer join. I have created two forms- one for the parent and one for the child table. I want to import the child table's form as a subform on the parent...
13
3274
by: bitsnbytes64 | last post by:
Hi, I have a form which contains a subform. Both are were creetd using the form wizard and are bound by the column IXO_NR (on two different tables), which is the control source for a textbox on both the parent and subform. The intent was to default the subform's IXO_NR to the parent form's IXO_NR, then requery the subform to prevent the user from having to scroll through all of the subform's records to find the one they may be looking for....
1
3600
by: troy_lee | last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with another table (Table B). I am having trouble with a form/subform setup to view the 1:M records. On the parent form, there is a combo box with a Select query to select one of the records in Table A. (The parent form is bound to Table A.) I want to be able to first, view all of the corresponding records from Table B and then second, give an option for editing these...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9236
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2180
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.