473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Addressing onCurrent Event of a SubForm

3
I would like to use the oncurrent event of a subform. The subform class seems to offer onEnter and onExit only, so I tried up to set the event handling routine programatically. It works fine with a macro:

MySubForm.Form.OnCurrent = "MyMacro"

But what about using VBA code? What procedure name does Access expect after having found

MySubForm.Form.OnCurrent = "[Event Procedure]" ?

MySubForm.Form.Name is "myQuery" so I tried up to define

myQuery_Current()
' .. do something ..
End Sub

but nothing happens. Any idea what could be wrong?
Jan 9 '08 #1
5 7488
jaxjagfan
254 Expert 100+
I would like to use the oncurrent event of a subform. The subform class seems to offer onEnter and onExit only, so I tried up to set the event handling routine programatically. It works fine with a macro:

MySubForm.Form.OnCurrent = "MyMacro"

But what about using VBA code? What procedure name does Access expect after having found

MySubForm.Form.OnCurrent = "[Event Procedure]" ?

MySubForm.Form.Name is "myQuery" so I tried up to define

myQuery_Current()
' .. do something ..
End Sub

but nothing happens. Any idea what could be wrong?
I think you were looking at the subform control that contains the subform when you stated "OnCurrent" not available. If you view the properties of the actual subform (not the container it is in) you will find all of the same events and properties of your main form.
Jan 9 '08 #2
TomK
3
There is no other form within the subform container but a query. Probably that is for there are no other properties or events accessible "within" the container. Seems the form object I was able to use its onCurrent event via a macro was then automatically created by Access?
Jan 9 '08 #3
missinglinq
3,532 Expert 2GB
Yes, if you base your subform on a table/query Access does generate a form (a subform has to be based on a form) and you can then access the properties of this generated form from within Design View by clicking on its little "magic box" in the upper left-hand corner. You can actually do the same thing and then go into it's code window as well. Access also places the generated form in the forms tab of the Objects Dialog box, naming it using the YourQueryName Subform format.

Welcome to TheScripts!

Linq ;0)>
Jan 9 '08 #4
TomK
3
For some reason, I am not able to access any properties of the subform object in Design View. The "magic box" called after focusing the subform showed only the property window of the main form, not the subform. And neither the Objects Dialog box nor the combo box with the object list contain the embedded subform.

However, I've got fixed the problem now by using a macro which is calling a VBA function. Pretty ugly ... but it does work. (Why on earth did MS not provide a way for setting event routines in code directly when they managed it for the macros???)

Thanks a lot for your assistance!

Tom
Jan 9 '08 #5
missinglinq
3,532 Expert 2GB
Another approach would be to make a form (even if you simply use the Forms Wizard) using the query as your recordset, then base the subform on this form.

Linq ;0)>
Jan 9 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Galina | last post by:
Hello I have an application in MS Access 2000. I have a form, which includes a subform. The subform is based on a table, but locked for any editing. There is Edit button. When clicked, it starts a...
7
by: Weaver | last post by:
I need to check the status of some records (detail records in a master detail form) _before_ moving off the current master record. Anyone know what event will catch this?
4
by: martin | last post by:
Anyone know what event is fired when a subform is loaded. I want to make the button invisible that loaded it. Thanx
3
by: bruce | last post by:
Hello, I am trying to figure out how to use a class with a custom event as a wrapper for a subform so that I can automatically trigger things to happen on the parent form when the custom event...
6
by: cefrancke | last post by:
I've read up on Access and the limits of creating visible controls at run-time. I'm using Access 2003 and assume that it cant be done. I did find a clever method of having a main form (and in...
2
by: Rational Repairs | last post by:
I have run into a sudden problem and thought I'd see if anyone else has ran into this. Out of nowhere (sort-of) I am not able to access the OnCurrent event on a subform. I, of course, can write...
4
by: Savita23 | last post by:
Hi, I have a subform in datasheet layout embedded in the main form.I want to invoke a procedure on the double click of each record in the subform.Is there a away by which I can fire the double...
2
RobH
by: RobH | last post by:
I have a Form - With a combo Box "Type" This selects a category eg TK, RR, PM etc In the subform it shows the records with field = Type On the subform I want to limit what Fields are visible...
1
by: Maciej Franciszkowski | last post by:
Hello, I dont know why only else part of if statement is effected when using below Private Sub Form_Current() If Me.NewRecord Then Me!nrpoz = DMax("", "", "= '" & Me.Parent.Nr_artykulu &...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.