473,842 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Thanks in Advance.
Nov 13 '05 #1
1 3738
> 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
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

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
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...
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...
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...
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...
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...
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...
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....
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...
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,...
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...
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,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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...
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...
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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

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.