473,405 Members | 2,185 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,405 software developers and data experts.

Callback Function requery problem in A97

Hi all,

Maybe I am just missing something simple here, but I seem to have an
issue with a callback function in A97 that is used to fill a Listbox
with values. The first time the callback function is used (when the
form opens) all runs well and everyone is happy. Then comes the
problem - values are added to the recordset (ADO) that the callback
function uses to populate the listbox.

After the new values are added to the recordset, the obvious thing to
do is to use the requery method for the listbox, hence activating the
callback function, and in theory re-populating the listbox with values
all over again. This is not what is happening. In fact the event
sequence that is taking place in the callback doesnt even hit event 6
(acLBGetValue) or event 3 (acLBGetRowCount), it goes like this... 8->2-
>8->9->0->2->1 and ends there. Still, somehow, magically, even with no
code relating to data population in any of these cases the records
appear in the listbox BUT the code crashes out saying that the
recordset is eith EOF or BOF....

Now I have F8 stepped my way through this, and here is the other most
curious thing: After I close the code window I get the EOF or BOF
message again and jump to debug and guess what? Its in event 6 trying
to get the data! Am I going insane here or I have I missed something
completely, or is my A97 I have to work with here deciding to play
with my mind? A copy of the code for the callback function is below.
The ADO recordset has two fields, both text. Oh yeah, and I am trying
to place the field names as the column headers (seems to work okay).

Function Mapped(ctl As Control, _
varId As Variant, lngRow As Long, lngCol As Long, _
intCode As Integer) As Variant

Dim varRetval As Variant

Select Case intCode
Case acLBInitialize
' Could you initialize?
If rsCategoryMap.RecordCount 0 Then
rsCategoryMap.MoveFirst
End If
varRetval = True

Case acLBOpen
' What's the unique identifier?
varRetval = Timer

Case acLBGetRowCount
' How many rows are there to be?
If rsCategoryMap.RecordCount = 0 Then
varRetval = 1
Else
varRetval = rsCategoryMap.RecordCount + 1
rsCategoryMap.MoveFirst
End If

Case acLBGetColumnCount
' How many columns are there to be?
varRetval = rsCategoryMap.Fields.Count

Case acLBGetValue
' What's the value in each row/column to be?
Select Case lngRow
Case (0)
varRetval = rsCategoryMap.Fields(lngCol).Name
Case Else
Select Case lngCol
Case (0)
varRetval = rsCategoryMap.Fields(lngCol).Value
Case Else
varRetval = rsCategoryMap.Fields(lngCol).Value
rsCategoryMap.MoveNext
End Select
End Select

Case acLBGetColumnWidth
' How many twips wide should each column be?
' (optional)

Case acLBGetFormat
' What's the format for each column to be?
' (optional)

Case acLBEnd
' Just clean up, if necessary (optional, unless you use
' an array whose memory you want to release).

End Select
Mapped = varRetval
End Function

Any help would be greatly appreciated. I would also like to know what
events 8 and 2 are. I have gone looking but to no avail....

Cheers

The Frog

Apr 18 '07 #1
11 1960
The Frog wrote:
Hi all,

Maybe I am just missing something simple here, but I seem to have an
issue with a callback function in A97 that is used to fill a Listbox
with values. The first time the callback function is used (when the
form opens) all runs well and everyone is happy. Then comes the
problem - values are added to the recordset (ADO) that the callback
function uses to populate the listbox.

After the new values are added to the recordset, the obvious thing to
do is to use the requery method for the listbox, hence activating the
callback function, and in theory re-populating the listbox with values
all over again. This is not what is happening. In fact the event
sequence that is taking place in the callback doesnt even hit event 6
(acLBGetValue) or event 3 (acLBGetRowCount), it goes like this... 8->2-
>>8->9->0->2->1 and ends there. Still, somehow, magically, even with no

code relating to data population in any of these cases the records
appear in the listbox BUT the code crashes out saying that the
recordset is eith EOF or BOF....

Now I have F8 stepped my way through this, and here is the other most
curious thing: After I close the code window I get the EOF or BOF
message again and jump to debug and guess what? Its in event 6 trying
to get the data! Am I going insane here or I have I missed something
completely, or is my A97 I have to work with here deciding to play
with my mind? A copy of the code for the callback function is below.
The ADO recordset has two fields, both text. Oh yeah, and I am trying
to place the field names as the column headers (seems to work okay).

Function Mapped(ctl As Control, _
varId As Variant, lngRow As Long, lngCol As Long, _
intCode As Integer) As Variant

Dim varRetval As Variant

Select Case intCode
Case acLBInitialize
' Could you initialize?
If rsCategoryMap.RecordCount 0 Then
rsCategoryMap.MoveFirst
End If
varRetval = True

Case acLBOpen
' What's the unique identifier?
varRetval = Timer

Case acLBGetRowCount
' How many rows are there to be?
If rsCategoryMap.RecordCount = 0 Then
varRetval = 1
Else
varRetval = rsCategoryMap.RecordCount + 1
rsCategoryMap.MoveFirst
End If

Case acLBGetColumnCount
' How many columns are there to be?
varRetval = rsCategoryMap.Fields.Count

Case acLBGetValue
' What's the value in each row/column to be?
Select Case lngRow
Case (0)
varRetval = rsCategoryMap.Fields(lngCol).Name
Case Else
Select Case lngCol
Case (0)
varRetval = rsCategoryMap.Fields(lngCol).Value
Case Else
varRetval = rsCategoryMap.Fields(lngCol).Value
rsCategoryMap.MoveNext
End Select
End Select

Case acLBGetColumnWidth
' How many twips wide should each column be?
' (optional)

Case acLBGetFormat
' What's the format for each column to be?
' (optional)

Case acLBEnd
' Just clean up, if necessary (optional, unless you use
' an array whose memory you want to release).

End Select
Mapped = varRetval
End Function

Any help would be greatly appreciated. I would also like to know what
events 8 and 2 are. I have gone looking but to no avail....

Cheers

The Frog
I haven't ever used your method in Case acLBGetValue. You are
movenexting within it. In all my code, it's done in the init.

I might have something like this. Under OptionExplicit
Private Type ComboList
strDesc As String
End Type

Then
Private Function MyFillFunction(fld As Control, ID As Variant, row As
Variant, col As Variant, Code As Variant) As Variant
On Error Resume Next
Static strRows() As ComboType
Static Entries As Integer

Dim varToHold As Variant
Dim ReturnVal As Variant

ReturnVal = Null

Select Case Code
Case acLBInitialize ' Initialize.
Dim rst As Recordset
Entries = 0
ReDim Preserve strRows(Entries)

strRows(Entries).strDesc = "(All)"

Dim rst As Recordset
Set rst = Currentdb.OpenRecordset("MyTable",dbopensnapshot)
Do While Not rst.EOF
Entries = Entries + 1
ReDim Preserve strRows(Entries)
strRows(Entries).strDesc = rst![Description]
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
ReturnVal = True
Case acLBOpen
ReturnVal = Timer
Case acLBGetRowCount ' Get number of rows
ReturnVal = Entries + 1
Case acLBGetColumnCount ' Get number of columns.
ReturnVal = 1
Case acLBGetColumnWidth ' Column width.
ReturnVal = -1 ' -1 forces use of default width.
Case acLBGetValue ' Get data.
ReturnVal = strRows(row).strDesc
Case acLBEnd ' End.
Erase strRows
End Select
FillInternalListBox = ReturnVal
End Function
I like using Types to hold my list of elements.
Apr 18 '07 #2
Hi Salad,

Thanks for the info. I gave this method a try, but for my listbox I
cannot use it exactly like this because the ADO recordset is an
unbound (constructed) recordset, and the re-initialisation at the
start kills any stored information by resetting the recordset.
Unfortunately it is not actually based on any particular table.

What I believe causes the issue, after a good night sleep on the
matter, is that the establishment of the column headers is upsetting
the rowcount, and as such might be better removed from the columns /
rows and done simply as labels over the column positions.

So here's the thinking - keep the recordset as a global var already
dimmed and set up before the form opens, then when the form opens the
callback function will be activated and return nothing for the
rowcount and hence no records. When the user updates data (taken from
other selections on the form and added by a click of a button), the
recordset is updated, the requery method is called for the listbox,
and in theory there are no more EOF / BOF issues as the rowcount will
match exactly the recordcount. Thats the theory, I will let you know
how it goes.

I tell you what, I really wish I were able to use a newer version of
access for this - life would be so much simpler......

Cheers and thanks :-)

The Frog

Apr 19 '07 #3
The Frog wrote:
Hi Salad,

Thanks for the info. I gave this method a try, but for my listbox I
cannot use it exactly like this because the ADO recordset is an
unbound (constructed) recordset, and the re-initialisation at the
start kills any stored information by resetting the recordset.
Unfortunately it is not actually based on any particular table.

What I believe causes the issue, after a good night sleep on the
matter, is that the establishment of the column headers is upsetting
the rowcount, and as such might be better removed from the columns /
rows and done simply as labels over the column positions.

So here's the thinking - keep the recordset as a global var already
dimmed and set up before the form opens, then when the form opens the
callback function will be activated and return nothing for the
rowcount and hence no records. When the user updates data (taken from
other selections on the form and added by a click of a button), the
recordset is updated, the requery method is called for the listbox,
and in theory there are no more EOF / BOF issues as the rowcount will
match exactly the recordcount. Thats the theory, I will let you know
how it goes.

I tell you what, I really wish I were able to use a newer version of
access for this - life would be so much simpler......

Cheers and thanks :-)

The Frog
I provided a very basic version of some code I use. In my Init I might
have a basic recordset that I clone then filter and sort. My rst that I
clone is dimmed in the declarations section of the form.

Ex: (using DAO) in the declarations section
Dim rst As Recordset

In the Listbox function
Set rstClone = rst.OpenRecordset
rstClone.Filter = ...
rstClone.Sort = ...

And then I process on rstClone the record count and stuff the listbox
rowitems into a Type'd structure.

I have the need to open the rst as needed in a subroutine as the data
gets updated often. Since it's been declared in the Declarations
section that is not a problem in referencing later.

I'm not sure why you must use ADO if that is causing problems. You
could always reference a DAO recordset with
Dim rst As DAO.Recordset

Good luck in your debugging.
Apr 19 '07 #4
Hi Salad,

Thanks for the pointers, I now believe I have a successful set of
instructions to make this work. By the way, the reason for using ADO
is to make use of the "constructed" recordset / disconnected recordset
capabilities. Although there are other ways to solve the issue here,
such as user defined data types, I will gain much benefit in later
steps of the processing by being able to work with recordsets like
this.

The successful code is listed below (note that there are two collumns
hence the select case statement in the acLBGetValue section):

Function Mapped(ctl As Control, _
varId As Variant, lngRow As Long, lngCol As Long, _
intCode As Integer) As Variant

Dim varRetval As Variant

Select Case intCode
Case acLBInitialize
' Could you initialize?
If rsCategoryMap.RecordCount 0 Then
rsCategoryMap.MoveFirst
End If
varRetval = True

Case acLBOpen
' What's the unique identifier?
varRetval = Timer

Case acLBGetRowCount
' How many rows are there to be?
If rsCategoryMap.RecordCount = 0 Then
varRetval = 0
Else
varRetval = rsCategoryMap.RecordCount
rsCategoryMap.MoveFirst
End If

Case acLBGetColumnCount
' How many columns are there to be?
varRetval = rsCategoryMap.Fields.Count

Case acLBGetValue
' What's the value in each row/column to be?
If Not rsCategoryMap.EOF Then
Select Case lngCol
Case (0)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
Case (1)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
rsCategoryMap.MoveNext
End Select
End If

Case acLBGetColumnWidth
' How many twips wide should each column be?
' (optional)

Case acLBGetFormat
' What's the format for each column to be?
' (optional)

Case acLBEnd
' Just clean up, if necessary (optional, unless you use
' an array whose memory you want to release).

End Select
Mapped = varRetval
End Function

This seems to work quite cleanly. Do you have any idea what events 2
and 8 are in the callback function (intCode var in my case)? The
callback function rties to reference them quite a bit when it is
operating, but I cannot find any reference to what they are
specifically. It more of an academic thing now, but I would still like
to know for future reference. Any ideas?

Cheers andd Thanks

The Frog

Apr 19 '07 #5
The first problem I see is that your initialize code does not load up the
record set

You have:

' Could you initialize?
If rsCategoryMap.RecordCount 0 Then
rsCategoryMap.MoveFirst
End If
varRetval = True

The problem is while the call back code is running, and you try and re-load
the reocrdset, how is the list box going to function during the time period
that you re-load the reocrdset?

Remember, call back means exactly what it says:

The operating system is call back to this code..not the other way
around.

What this means that the operation system will attempt to often re-plot, and
re-call the code over and over when windows needs to re-plot the screen.
This can occur by simply moving the window, or even dragging a complete
un-related application (like note pad) over the window, and then windows OS
will being calling the code over and over as it attempts to re-plot the
screen.

That code has to be able to run independently of any other code.

The above scenario thus answers the following:

Case acLBOpen
' What's the unique identifier?
varRetval = Timer

the above identify is simply a handle that windows uses to know which piece
of code to call. You might have two, or 3 combo box on the screen. When the
OS calls back, it needs a way to keep track of what code it is running. You
can well think of this as a auto number id for code. (just like each record
in a table often needs a unique identifier, often OS code needs a identifier
for the call back. You could just give the above a number like 123. The
developer of that code obviously just did not care, and used "timer"...which
is just also fine...

So, your problem is much that were is this code that re-loads the recordset,
but worse, how are you going to control the calling of the call back code
when you re-load the reocrdset code? (answer: you can't know when the code
is going to be called, and the code is OFTEN going to be called while your
reloading the roecrdset..but the code already referring the reocrset? so,
you can't load up the reocrdset somewhere else, you MUST let the
combo/listbox load up the data when it needs to (becuase you never know when
it will).

solution:

* You really really really want to put the code that loads, sets up,
pulls data into the reocrdset in the initialize event...

Case acLBInitialize
' Could you initialize?
If rsCategoryMap.RecordCount 0 Then
rsCategoryMap.MoveFirst
End If
varRetval = True

The above is not good enough. You really want to loadup, set, create the
reocrdset code in the initialize event. So, have the above event call your
code that actually loads up, and creates, and sets up the reocrdset.

Then, when you do a me.MyListBox.Requery, the initialize code will re-load
the reocrdset code, not some of YOUR code somewhere else. You have to let
the combo/listbox do the loading of the above since as I mentioned the call
back will run the code at will, and without any regards to timing. This is a
asynchronous process, and that simply means that the OS will call that code
any time it pleases, and thus no timing can bee assumed (thus it might even
occur while your "other" code is trying to re-load the recodset). So, the
above initialise event is the ONLY event you can be sure of to use to load
up the data and during that time, the other options in the callback code
will not fire.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Apr 19 '07 #6
The Frog wrote:
Hi Salad,

Thanks for the pointers, I now believe I have a successful set of
instructions to make this work. By the way, the reason for using ADO
is to make use of the "constructed" recordset / disconnected recordset
capabilities. Although there are other ways to solve the issue here,
such as user defined data types, I will gain much benefit in later
steps of the processing by being able to work with recordsets like
this.

The successful code is listed below (note that there are two collumns
hence the select case statement in the acLBGetValue section):

Function Mapped(ctl As Control, _
varId As Variant, lngRow As Long, lngCol As Long, _
intCode As Integer) As Variant

Dim varRetval As Variant

Select Case intCode
Case acLBInitialize
' Could you initialize?
If rsCategoryMap.RecordCount 0 Then
rsCategoryMap.MoveFirst
End If
varRetval = True

Case acLBOpen
' What's the unique identifier?
varRetval = Timer

Case acLBGetRowCount
' How many rows are there to be?
If rsCategoryMap.RecordCount = 0 Then
varRetval = 0
Else
varRetval = rsCategoryMap.RecordCount
rsCategoryMap.MoveFirst
End If

Case acLBGetColumnCount
' How many columns are there to be?
varRetval = rsCategoryMap.Fields.Count

Case acLBGetValue
' What's the value in each row/column to be?
If Not rsCategoryMap.EOF Then
Select Case lngCol
Case (0)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
Case (1)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
rsCategoryMap.MoveNext
End Select
End If

Case acLBGetColumnWidth
' How many twips wide should each column be?
' (optional)

Case acLBGetFormat
' What's the format for each column to be?
' (optional)

Case acLBEnd
' Just clean up, if necessary (optional, unless you use
' an array whose memory you want to release).

End Select
Mapped = varRetval
End Function

This seems to work quite cleanly. Do you have any idea what events 2
and 8 are in the callback function (intCode var in my case)? The
callback function rties to reference them quite a bit when it is
operating, but I cannot find any reference to what they are
specifically. It more of an academic thing now, but I would still like
to know for future reference. Any ideas?
I'm not sure what you want to know here. If I understand you correctly,
you could get to a debug window and do something like
? acLBOpen
and the other variables in the function and determine their values.

Besides what I and Albert have mentioned...for a while when I'd requery
with new data I might have simply performed a
Me.ComboBox.RowSource = "Select ... From Table...Where ..."

This REALLY puts a drag on time to reload and display. I found that
spending the time by doing a callback on these combos made the redisplay
lightning fast.

By storing the results in my defined Types, in the init, the data is
stored in memory. Using your method, even if it works, requires a bunch
of diskreads because it's done outside of the init whereas once I've
init'ed the data everything else is performed in memory.

One other thing. In my itit section I often create as the first row the
headers for each column.

As a developer I recognize that there are multiple ways of doing things
and that the bottom line is that if it works that is the optimal desired
result. So if it works and you are satisfied, then you are happy.
Apr 19 '07 #7
Thankyou both Alan and Salad,

I understand now where the issue was originating from. In this
situation the recordset is not actually attached to a table or query,
and is already built in ADO before the form even opens (global var),
so there is no reason to pump data to it or anything like that. The
button that the user clicks after making their choices pumps the
choices into this recordset, and then calls the requery for the
listbox to display the choices in two columns.

What I did to get around the issue was basically leave the initialise
event alone completely as there really is nothing to initialise in
this scenario. Now that I know the exact purpose of the initialise
event I can use properly for the next form I have to design which will
use a recordset attached to a table. The reason for the IF statement
was simply to reset the position of the cursor for the acLBGetData
stage, since I could not guarantee the cursor position any other way.

The other area that was causing a problem was the acLBGetData because
it was always hitting the EOF condition. I was unable to think of a
way to reposition the cursor and guarantee the cursor was at the
correct row for data to be read with code only in this secition /
case. This was the reasaon for the movefirst statement in the
initialisation. The code that eventually worked for me in the getdata
case is:

If Not rsCategoryMap.EOF Then
Select Case lngCol
Case (0)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
Case (1)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
rsCategoryMap.MoveNext
End Select
End If

this is not the most elegant solution I am sure, but it does seem to
function reliably.

So the whole data handling process goes like this:
1/ User makes choices in various places on a form
2/ user clicks a button
3/ code for the button collects the values of the user choices on the
form and places them as a new record in the ADO constructed recordset
(ie/ recordset with no actual table or query as its basis - it is made
purely in memory from code)
4/ code for the button now calls the requery event for the listbox
5/ data from the recordset is placed in the listbox
6/ form is reset for more user choices to be made....and the process
can repeat.....

So far this seems to work okay. I cant think of another way to
approach this for a recordset that has no table or query and is purely
constructed in code. If it were a recordset that was based on a table
or query or a clone I would handle it differently, but I cant see any
other way in this case.

By the way Salad, how did you do the column headings in the Init
section? The only way that I know of is to have the ColumnHeadings
property for the listbox to be set to Yes, and to have the first data
returned in the acLBGetData step as the names for the columns. Is
there another way?

Cheers and thanks to both of you, you have been of great help. I
really do appreciate this.

The Frog

PS: Any ideas on what cases 2 and 8 might be?

Apr 20 '07 #8
PS: Any ideas on what cases 2 and 8 might be?
I assume by case 2 you mean:
Case acLBOpen
' What's the unique identifier?
varRetval = Timer

I gave an explain for the above in my previous post!!

Case 8 is *exactly* the same concept as when you kill, or destroy a class
object, the "terminate" method of a class object fires when the object is
being destroyed. (you can look up terminate in the access help). So, the
call back system (control) when being un-loaded (like closing the form)
will fire. This means your code can free up memory, and clean up resources
used when the form closes.

By the way, you can continue to use your approach, it just that the loading
up of the reocordset has to occur via that initialize event. You can put
code in your initialize event to not re-load every time
eg:

dim bolLoaded as boolean

if bolLoaded = true then
exit sub
end if

' code goes here to load up reocrdset
bolLoaded = True

And, if you later in code need to re-initlize the reocrdset, then you go:

bolLoaded = False
me.MyComboBox.Requery
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Apr 20 '07 #9
Albert, Thankyou.

Sorry about the case 2 and 8 thing before. My mind was so wrapped up
in the problem that I confused myself. Thankyou for the explanation of
case 8 (terminate case). I couldnt seem to locate a thing on it. Nice
explanation - clean and to the point.

Thanks for the heads up on the recordset initialisation bit too. I
hadnt though of using a variable to hold the state of the recordset. I
have made the alterations to my code to accomodate it. Its nice to
keep the code for a form with the form itself and not have your
initialisation rely on the exit procedure of the previous form. Much
appreciated.

While I think of it, do you know any use for the acLBClose case? I
have never seen it called. Is there a purpose to this or just an idea
that got ditched in the development of Access ("We thought it was good
at the time......")??

Thankyou once again.

The Frog
Apr 20 '07 #10
The Frog wrote:
Thankyou both Alan and Salad,

I understand now where the issue was originating from. In this
situation the recordset is not actually attached to a table or query,
and is already built in ADO before the form even opens (global var),
so there is no reason to pump data to it or anything like that. The
button that the user clicks after making their choices pumps the
choices into this recordset, and then calls the requery for the
listbox to display the choices in two columns.

What I did to get around the issue was basically leave the initialise
event alone completely as there really is nothing to initialise in
this scenario. Now that I know the exact purpose of the initialise
event I can use properly for the next form I have to design which will
use a recordset attached to a table. The reason for the IF statement
was simply to reset the position of the cursor for the acLBGetData
stage, since I could not guarantee the cursor position any other way.

The other area that was causing a problem was the acLBGetData because
it was always hitting the EOF condition. I was unable to think of a
way to reposition the cursor and guarantee the cursor was at the
correct row for data to be read with code only in this secition /
case. This was the reasaon for the movefirst statement in the
initialisation. The code that eventually worked for me in the getdata
case is:

If Not rsCategoryMap.EOF Then
Select Case lngCol
Case (0)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
Case (1)
varRetval =
Trim(rsCategoryMap.Fields(lngCol).Value)
rsCategoryMap.MoveNext
End Select
End If

this is not the most elegant solution I am sure, but it does seem to
function reliably.

So the whole data handling process goes like this:
1/ User makes choices in various places on a form
2/ user clicks a button
3/ code for the button collects the values of the user choices on the
form and places them as a new record in the ADO constructed recordset
(ie/ recordset with no actual table or query as its basis - it is made
purely in memory from code)
4/ code for the button now calls the requery event for the listbox
5/ data from the recordset is placed in the listbox
6/ form is reset for more user choices to be made....and the process
can repeat.....

So far this seems to work okay. I cant think of another way to
approach this for a recordset that has no table or query and is purely
constructed in code. If it were a recordset that was based on a table
or query or a clone I would handle it differently, but I cant see any
other way in this case.

By the way Salad, how did you do the column headings in the Init
section? The only way that I know of is to have the ColumnHeadings
property for the listbox to be set to Yes, and to have the first data
returned in the acLBGetData step as the names for the columns. Is
there another way?
I made it the first row element. Using the Type definition I created,
it might read something like

Entries = 0

strRows(Entries).CustomerName = "Customer"
strRows(Entries).OrderDate = "Order Date"
etc.
Elements 1 and beyond contain the data. Of course, column headings need
to be turned on.
Apr 20 '07 #11
While I think of it, do you know any use for the acLBClose case? I
have never seen it called. Is there a purpose to this or just an idea
that got ditched in the development of Access ("We thought it was good
at the time......")??
As I said, that event must get fired when you close the form.....

I mean, it likely similar to the terminate event of a class object.

So, for example, you would use this event to close the reocrdet, or free up
the memory used by a possible large array. So, this event is thus to clean
up, and un-load all the stuff you did in the initialize event.

After that form closes, all those resources and memory and reocrdsets you
are using should be closed down and the resources returned to the system.

So, it just like a terminate event in a class object.

That event will fire when you close the form. I mean, you could put the code
to clean things up in the forms close event, but makes more sense to place
the code in the call-back routine (since that the place where you have the
initialize event that loaded up all that data).

So, that event is just the "other" side, or "opposite" event of the
initialize.

It is just a event available for you to clean up your resources and close
down things. You might for example send the data to a array, and thus need
to clear out that array when the form closes.
So, that event fires when the form closes, but I suspect there are other
possible cases to make it fire..

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Apr 21 '07 #12

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

Similar topics

4
by: ma740988 | last post by:
// file sltest.h #ifndef SLTEST_H #define SLTEST_H class CallbackBase // herb shutters gotW source .. { public: virtual void operator()() const { }; virtual ~CallbackBase() = 0; };
15
by: Felix Kater | last post by:
Hi, in a given library I register callback functions with this function: bool set_callback(int index, int (*callback_function)(long)); I need the callback function to also pass the index...
8
by: kurtcobain1978 | last post by:
-------------------------------------------------------------------------------- I need to do the exactly same thing in VB.NET. Load a unmanaged C DLL dynamically and then call a function in...
6
by: smmk25 | last post by:
Before I state the problem, I just want to let the readers know, I am knew to C++\CLI and interop so please forgive any newbie questions. I have a huge C library which I want to be able to use in...
2
by: Pradeep | last post by:
Hi all, Can any one explain me what is callback function.... I have written some code after reading some tutorials from internet... But I am not sure is it a right way to write a call back...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
6
by: jmDesktop | last post by:
In a function that takes another function (function pointer) as a argument, or the callback function, which is the one that "calls back"? I'm having a hard time understanding the language. Am I...
5
by: Jef Driesen | last post by:
I have a C DLL that I want to use from a C# project. The C header file contains these declarations: typedef void (*callback_t) (const unsigned char *data, unsigned int size, void *userdata);...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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
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
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
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...

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.