PC Review


Reply
Thread Tools Rate Thread

Continuous Forms as Subforms

 
 
John S
Guest
Posts: n/a
 
      24th Nov 2003
John Here, from "Savebutton madness". A few people suggested that I try a
bound, continuous forms instead of an unbound datasheets for data in a
subform. My goal was to to get fairly bulletproof data validation. I've been
trying to arrange data validation in the continuous form, using various
events, but with very little success. The continuous form is bound to a
table.

For example, when I use the "before_update" event on a control (a text box),
the event keeps triggering even after I fix an error. And when I use an
"exit" event, the database (and not the event) captures any attempt to put a
letter in a numeric field.

Has anyone any experience doing validation on bound continuous forms used in
subforms. Suggestions? Tips (like what is the best event to work with)?
References that might be helpful?

John S
Aylmer, PQ


 
Reply With Quote
 
 
 
 
Rick Brandt
Guest
Posts: n/a
 
      24th Nov 2003
"John S" <praxis-(E-Mail Removed)> wrote in message
news:_Ptwb.8031$(E-Mail Removed)...
> John Here, from "Savebutton madness". A few people suggested that I try a
> bound, continuous forms instead of an unbound datasheets for data in a
> subform. My goal was to to get fairly bulletproof data validation. I've been
> trying to arrange data validation in the continuous form, using various
> events, but with very little success. The continuous form is bound to a
> table.
>
> For example, when I use the "before_update" event on a control (a text box),
> the event keeps triggering even after I fix an error. And when I use an
> "exit" event, the database (and not the event) captures any attempt to put a
> letter in a numeric field.
>
> Has anyone any experience doing validation on bound continuous forms used in
> subforms. Suggestions? Tips (like what is the best event to work with)?
> References that might be helpful?


If you want validation "per control" then the BeforeUpdate event of the control
is the best place. If you want to validate "per record" then the BeforeUpdate
event of the form is the best place. I don't understand your statement about
the event still firing after you fix the error. Perhaps if you posted your
code? For example the code below would prevent an entry in a TextBox named
ValidationTest that was greater than 100.

Private Sub ValidationTest_BeforeUpdate(Cancel As Integer)

If Me!ValidationTest > 100 Then
MsgBox "Invalid Entry"
Cancel = True
End If

End Sub


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



 
Reply With Quote
 
John S
Guest
Posts: n/a
 
      25th Nov 2003
Rick,

Could be me, but here is the offending code. What happens is that once an
error is made, it will not accept a correction (it keeps saying the wrong
letter has been used)..

If IsNull(txtType.Value) Or Len(txtType <> 1) Then
MsgBox "Vous devez mettre seulement[D] (Chien) ou [C] (CHAT)"
txtType.Value = ""
txtType.SetFocus
Cancel = True

End If

If UCase(txtType.Value) = "C" Or UCase(txtType.Value) = "D" Then
Exit Sub
Else:
MsgBox "Seulement 'C'[ chat] or 'D'[chien] SVP"
txtType.Value = ""
txtType.SetFocus
Cancel = True
End If

Tried variations such as removing setfocus and setting the value to null,
and moving around the "exit sub" to no effect. Both if statements are
failing (I tried removing the second).

John S
Aylmer, PQ
"Rick Brandt" <(E-Mail Removed)> wrote in message
news:bptqg1$1rea4v$(E-Mail Removed)...
> "John S" <praxis-(E-Mail Removed)> wrote in message
> news:_Ptwb.8031$(E-Mail Removed)...
> > John Here, from "Savebutton madness". A few people suggested that I try

a
> > bound, continuous forms instead of an unbound datasheets for data in a
> > subform. My goal was to to get fairly bulletproof data validation. I've

been
> > trying to arrange data validation in the continuous form, using various
> > events, but with very little success. The continuous form is bound to a
> > table.
> >
> > For example, when I use the "before_update" event on a control (a text

box),
> > the event keeps triggering even after I fix an error. And when I use an
> > "exit" event, the database (and not the event) captures any attempt to

put a
> > letter in a numeric field.
> >
> > Has anyone any experience doing validation on bound continuous forms

used in
> > subforms. Suggestions? Tips (like what is the best event to work with)?
> > References that might be helpful?

>
> If you want validation "per control" then the BeforeUpdate event of the

control
> is the best place. If you want to validate "per record" then the

BeforeUpdate
> event of the form is the best place. I don't understand your statement

about
> the event still firing after you fix the error. Perhaps if you posted

your
> code? For example the code below would prevent an entry in a TextBox

named
> ValidationTest that was greater than 100.
>
> Private Sub ValidationTest_BeforeUpdate(Cancel As Integer)
>
> If Me!ValidationTest > 100 Then
> MsgBox "Invalid Entry"
> Cancel = True
> End If
>
> End Sub
>
>
> --
> I don't check the Email account attached
> to this message. Send instead to...
> RBrandt at Hunter dot com
>
>
>



 
Reply With Quote
 
OzPete
Guest
Posts: n/a
 
      25th Nov 2003
I just love that MsgBox error message!!!
I am going to unashamedly steal that one...
twisted sense of humour I know....
but I can just see the Aussies trying to work THAT one out!

OzPete
[self-inflicted exiled Englishman]

"John S" wrote in message...
> Rick,
>
> Could be me, but here is the offending code. What happens is that once an
> error is made, it will not accept a correction (it keeps saying the wrong
> letter has been used)..
>
> If IsNull(txtType.Value) Or Len(txtType <> 1) Then
> MsgBox "Vous devez mettre seulement[D] (Chien) ou [C] (CHAT)"




 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      25th Nov 2003
"John S" <praxis-(E-Mail Removed)> wrote in message
news:YJEwb.75891$(E-Mail Removed)...
> Rick,
>
> Could be me, but here is the offending code. What happens is that once an
> error is made, it will not accept a correction (it keeps saying the wrong
> letter has been used)..
>
> If IsNull(txtType.Value) Or Len(txtType <> 1) Then
> MsgBox "Vous devez mettre seulement[D] (Chien) ou [C] (CHAT)"
> txtType.Value = ""
> txtType.SetFocus
> Cancel = True
>
> End If


If you use BeforeUpdate you don't need to set focus back to the control or
change its value (neither of which will work anyway.) Cancel = True will cancel
the update which means the control will never lose focus in the first place.
You can then either leave the value alone and let the user change it or use the
Undo method to "undo" their entry. The former is more standard.

Len(txtType <> 1) is incorrect syntax. The closing parenthesis should be after
the control name.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com




 
Reply With Quote
 
John S
Guest
Posts: n/a
 
      26th Nov 2003
Rick

Sigh. How embarrassing (didn't see it) and jumped to conclusions. Thanks.

John S
Aylmer, PQ

"Rick Brandt" <(E-Mail Removed)> wrote in message
news:bpvl1p$1tclmc$(E-Mail Removed)...
> "John S" <praxis-(E-Mail Removed)> wrote in message
> news:YJEwb.75891$(E-Mail Removed)...
> > Rick,
> >
> > Could be me, but here is the offending code. What happens is that once

an
> > error is made, it will not accept a correction (it keeps saying the

wrong
> > letter has been used)..
> >
> > If IsNull(txtType.Value) Or Len(txtType <> 1) Then
> > MsgBox "Vous devez mettre seulement[D] (Chien) ou [C] (CHAT)"
> > txtType.Value = ""
> > txtType.SetFocus
> > Cancel = True
> >
> > End If

>
> If you use BeforeUpdate you don't need to set focus back to the control or
> change its value (neither of which will work anyway.) Cancel = True will

cancel
> the update which means the control will never lose focus in the first

place.
> You can then either leave the value alone and let the user change it or

use the
> Undo method to "undo" their entry. The former is more standard.
>
> Len(txtType <> 1) is incorrect syntax. The closing parenthesis should be

after
> the control name.
>
>
> --
> I don't check the Email account attached
> to this message. Send instead to...
> RBrandt at Hunter dot com
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuous Forms and Subforms Jasper Recto Microsoft Access 6 13th Sep 2008 06:04 AM
Continuous Forms and Subforms Jasper Recto Microsoft Access Forms 6 13th Sep 2008 06:04 AM
simulate continuous forms & subforms in a windows forms application BillE Microsoft Dot NET 0 7th May 2008 09:20 PM
Subforms, Continuous Forms, and Locking Columns oh my...? BodiKlamph@gmail.com Microsoft Access Forms 2 12th Nov 2007 10:11 PM
access97 subforms in continuous forms Steve Ferry Windows XP 0 9th Aug 2005 02:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:22 AM.