By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,512 Members | 3,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,512 IT Pros & Developers. It's quick & easy.

Next Record / Previous Record - what event occurs?

P: n/a
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
Share this Question
Share on Google+
15 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.