473,394 Members | 1,709 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,394 software developers and data experts.

Next Record / Previous Record - what event occurs?

Greetings. I have a Mainform with a subform. The Mainform has single
record format and subform has continuous form format. When the Mainform
opens, I force allowadditions and allowedits to FALSE (for both the
Mainform and Subform). No problem there.

However, when I click on the navigation control of the subform to move
to the next record in the subform, the AllowAdditions and AllowEdits
changes to TRUE. Not good.

I set breakpoints at Form_KeyDown( ) and Form_KeyPress( ) in the
subform's module, to trace the problem, but neither breakpoint got hit.

QUESTION: What event occurs when the Navigation Control Next record or
Previous record are clicked?

Thanks much.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
15 11214
Susan Bricker wrote:
Greetings. I have a Mainform with a subform. The Mainform has single
record format and subform has continuous form format. When the
Mainform opens, I force allowadditions and allowedits to FALSE (for
both the Mainform and Subform). No problem there.

However, when I click on the navigation control of the subform to move
to the next record in the subform, the AllowAdditions and AllowEdits
changes to TRUE. Not good.

I set breakpoints at Form_KeyDown( ) and Form_KeyPress( ) in the
subform's module, to trace the problem, but neither breakpoint got
hit.

QUESTION: What event occurs when the Navigation Control Next record or
Previous record are clicked?


Current event of the form, and it would not change your AllowAdditions and
AllowEdits settings unless it contained code to explicitly do so.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
Rick,

Thanks for the info. I did hit CurrentEvent of the subform. However,
somehow those properties are changing. I have traced it around 10 times
now and it doesn't seem to go anywhere after the end of the Form_Current
routine (in the Subform). I have tried setting a "Watch" entry to see
when the value of the property changes, but I may not be setting the
Watch up properly because I don't get any hits on that, either.

Wow, this is a toughy.

I'd gladly send my mdb file (zipped) to anyone who would be interested
in helping. Just send an email address. Thank you, again, for trying
to help.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3
rkc
Susan Bricker wrote:
Thanks for the info. I did hit CurrentEvent of the subform. However,
somehow those properties are changing. I have traced it around 10 times
now and it doesn't seem to go anywhere after the end of the Form_Current
routine (in the Subform). I have tried setting a "Watch" entry to see
when the value of the property changes, but I may not be setting the
Watch up properly because I don't get any hits on that, either.


Try setting break points at each line in your code that changes
the allowadditions and allowedits properties. That's as simple as
clicking in the left hand margin at the start of the line. You can
then put your cursor over any variable, in any procedure, that hasn't
gone out of scope to see it's value.
Nov 13 '05 #4
I am so stuck on this one. A large icecream sundae to someone who can
help me (ok ... I can't really do that ... but if I could I would).

I have tried resetting the AllowAdditions and AllowEdits properties of
the subform to FALSE in the OnCurrent and AfterUpdate events. That
didn't work. I was still able to update the data in the subform after
moving to the next record with the Navigation Control. I have tried
setting Cancel to TRUE in the BeforeUpdate event of the subform. That
was no good because that canceled the 'move to next record' event (no
good).

Problem: I have the Main Form and Subform with AllowAdditions and
AllowEdits set to FALSE. I move to the next record in the Subform and
then try to change data in the subform and even though I expect to be
prevented, I can make the change. UGHHH!!!

I know that someone said that I must be explicitly changeing the
properties, but I just don't see it. I'll gladly send my mdb file to
someone to debug for me.

HELP!!!! I really need to get past this problem, quickly.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5
Susan Bricker wrote:
[snip]
Problem: I have the Main Form and Subform with AllowAdditions and
AllowEdits set to FALSE. I move to the next record in the Subform and
then try to change data in the subform and even though I expect to be
prevented, I can make the change. UGHHH!!!

I know that someone said that I must be explicitly changeing the
properties, but I just don't see it. I'll gladly send my mdb file to
someone to debug for me.[snip]


Is there *any* code in the current event of the subform? If so post it.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #6
Rick,

Hi. Here's the Form_Current( ) and Form_Load( ) routines from the
subform sfrmTrialInfo:

More Info:
Mainform = frmEvents (based on tblEvents)
Subform control = subfrmTI
Subform name = sfrmTrialInfo (based on tblTrials)
In sfrmTrialInfo:
Subform control = subfrmTCI
Subform name = sfrmTrialClass (based on TblTrialClass)

Relationships:
Events->Trials (1 to many)
Trials->Classes (1 to many)

*====================================*

Private Sub Form_Current()
On Error GoTo Err_Form_Current

Dim intCount As Integer
Dim db As DAO.Database
Dim rsT As DAO.Recordset
Dim strSQL As String
If blnYesRecords Then 'If there are TRIAL RECORDS then do the
following
If strMode = "BROWSE" Or strMode = "UNKNOWN" Then
'Find out if there are any records in tblTrialClass for this
Trial
intCount = DCount("[trialclassID]", _
"tblTrialClass", _
"[trialID] = " & Me![trialID])
If intCount = 0 Then
' Display message that says there are no Classes for
this Trial
Me![lblNoClassRecs].Visible = True
Me![subfrmTCI].Visible = False
Else
Me![lblNoClassRecs].Visible = False
Me![subfrmTCI].Visible = True
End If
Me![cboTrialRep] = Me![repID]
End If ' End of BROWSE/UNKNOWN Mode

'Me![cboTrialRep] = Me![repID]
End If ' End of YES TRIAL RECORDS EXIST
Exit_Form_Current:
Exit Sub

Err_Form_Current:
Call ShowError("sfrmTrialInfo", "Form_Current", Err.Number,
Err.Description)
Resume Exit_Form_Current
End Sub

*===================================*

Private Sub Form_Load()
'Find out if we have any Trial Records
If Me.RecordsetClone.EOF Then
blnYesRecords = False
Else
blnYesRecords = True
End If
End Sub
*===================================*

In the Form_Current( ) routine, the variable strMode is, indeed,
"BROWSE" (setup in previous form). It's a global variable defined in a
CommonProcs module that I have for common routines.

Thanks.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #7
I like icecream ....

What version of Access ?
If your mdb-version <= Acc2000 then you may send it and I will have a look...
(Remove the obvious from my email-address)

Arno R

"Susan Bricker" <sl*****@verizon.net> schreef in bericht news:29*************@news.uswest.net...
I am so stuck on this one. A large icecream sundae to someone who can
help me (ok ... I can't really do that ... but if I could I would).

I have tried resetting the AllowAdditions and AllowEdits properties of
the subform to FALSE in the OnCurrent and AfterUpdate events. That
didn't work. I was still able to update the data in the subform after
moving to the next record with the Navigation Control. I have tried
setting Cancel to TRUE in the BeforeUpdate event of the subform. That
was no good because that canceled the 'move to next record' event (no
good).

Problem: I have the Main Form and Subform with AllowAdditions and
AllowEdits set to FALSE. I move to the next record in the Subform and
then try to change data in the subform and even though I expect to be
prevented, I can make the change. UGHHH!!!

I know that someone said that I must be explicitly changeing the
properties, but I just don't see it. I'll gladly send my mdb file to
someone to debug for me.

HELP!!!! I really need to get past this problem, quickly.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #8
Arno,

I'm using Access 2k. Thanks for the offer of help. However, I don't
see your email address in your post or in the post header. Where is it?

SueB
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #9
Susan,
You must be able to see it in the header ...
It says: ar***********@tiscali.nl there, or don't you see that where you post from ??

Arno R

"Susan Bricker" <sl*****@verizon.net> schreef in bericht news:Yg*************@news.uswest.net...
Arno,

I'm using Access 2k. Thanks for the offer of help. However, I don't
see your email address in your post or in the post header. Where is it?

SueB
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #10
Susan Bricker wrote:
Rick,

Hi. Here's the Form_Current( ) and Form_Load( ) routines from the
subform sfrmTrialInfo:


You appear to be setting the values of fields in your current event.
Programmatically setting any field value removes the AllowEdits = No
(because the code has already dirtied the record).

The various settings of "properties" like visible, locked, or enabled are
fine, but you can't set any field values if you want to maintain AllowEdits
= No.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #11
Arno,

It must have something to do with where I'm posting from. I'm at work
and the security here is very heavy. Of course, don't tell anyone that
I'm doing this : ) because it's not work related. I'll get the mdb file
off to you soon.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #12
Arno,

It must have something to do with where I'm posting from. I'm at work
and the security here is very heavy. Of course, don't tell anyone that
I'm doing this : ) because it's not work related. I'll get the mdb file
off to you soon.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #13
I did receive the mdb.
(I think Rick allready hit the nail ...)

Where can I send the mdb to after I added/modified some code ?

Arno R
"Susan Bricker" <sl*****@verizon.net> schreef in bericht news:ZG*************@news.uswest.net...
Arno,

It must have something to do with where I'm posting from. I'm at work
and the security here is very heavy. Of course, don't tell anyone that
I'm doing this : ) because it's not work related. I'll get the mdb file
off to you soon.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #14
Hi Susan,
I was figuring it would not be a good idea to mail the db back to your office ...
Since I don't here from you again, I will post back here in the group.

I had a quick look and (as Rick told you allready) you were dirtying the form.
When the form opens you can immediately see the 'pencil' ...
If you disable the line
Me![cboTrialRep] = Me![repID], the form works as you want I guess.

While the value of Me.AllowEdits stays 'False' all the time, I can in fact change some values...
I think Access is at the least 'confused' by this 'dirty' codeline... ;-)
The explanation given by Rick is valid I guess, but the property is not set 'properly'
When you use code like:
Private Sub trialcode_Enter()
MsgBox "Allowedits: " & Me.AllowEdits
End Sub
in the subform you can see that despite the fact that you *can* change values, Access keeps repeating that AllowEdits =False

The offending code does nothing else then set cboTrialRep to repID
Also there is:
Private Sub cboTrialRep_AfterUpdate()
Me![repID] = Me![cboTrialRep].Column(0)
End Sub
(but both repID and cboTrialRep have the field RepID as the controlsource ...)

So: disable the line: Me![cboTrialRep] = Me![repID and you are done with this issue.
As you said in your private mail: There still is work to be done ... (also by the Access-team...)

HTH
Arno R

Nov 13 '05 #15
rkc
Arno R wrote:
So: disable the line: Me![cboTrialRep] = Me![repID and you are done with this issue.
As you said in your private mail: There still is work to be done ... (also by the Access-team...)

or maybe

Me![cboTrialRep] = Me![repID]
Me.dirty = false
Me.AllowEdits = false
Nov 13 '05 #16

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

Similar topics

5
by: Rick | last post by:
I am moving throught a set of records, my next works great but previous move to the first record. Also what is the best way to check and see if it is the first or last record in the set. ...
5
by: Bob Bedford | last post by:
Does exist a next prev function in PHP/Mysql. I've a website with returns lot of records (say about 200). The user may browse trough the list or returned records, but he has to click the record...
1
by: ubmc | last post by:
Revised form layout by dragging/dropping fields from field list and deleting unwanted fields. However, unable to go to next existing record or return to previous existing record, but can add new...
9
by: Karl Roes | last post by:
Hi All, I would like some advice on Next / Previous record buttons. I have a main form for the client, and a continuous subform listing client transactions. If I open one of these transactions...
0
by: David C | last post by:
I am gathering some ideas. Just like after you open up an email, on the screen are the previous and next buttons. You can navigation to the next or previous record. So how would you maintain...
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
16
by: zoeb | last post by:
Hi, I am a complete novice to Access VBA and looking for some help to select a record. I am looking to perform an operation on the previous record - i.e. adding a new blank field, and then...
3
by: bhupesh8525 | last post by:
please help me thank to you in advance
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
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
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...

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.