Connecting Tech Pros Worldwide Help | Site Map

.Undo for unbound controls?

ARC
Guest
 
Posts: n/a
#1: Jul 13 '07
I've noticed that if you use code for the before update command for unbound
controls, it doesn't really work.

I tried the following:

Me!ExportedYN.undo
Cancel = True
DoCmd.CancelEvent
Exit Sub

However, putting the above code in the before update on unbound controls
does NOT undo their typing. Does anyone know the proper way for unbound
controls?

Many Thanks,


Bob Quintal
Guest
 
Posts: n/a
#2: Jul 13 '07

re: .Undo for unbound controls?


"ARC" <andy@andyc.comwrote in
news:BYPli.18884$Rw1.12488@newssvr25.news.prodigy. net:
Quote:
I've noticed that if you use code for the before update
command for unbound controls, it doesn't really work.
>
I tried the following:
>
Me!ExportedYN.undo
Cancel = True
DoCmd.CancelEvent
Exit Sub
>
However, putting the above code in the before update on
unbound controls does NOT undo their typing. Does anyone know
the proper way for unbound controls?
>
Many Thanks,
>
The reason is that the before update event may reject an entry
because of a spelling misteak and users get annoyed if they have
to retype the whole mistake instead of just editing the
previously typed data.

In addition to the Cancel = true statement,
put me.ExportedYN.text = ""
(I'm guessing that ExportedYN is your control name. .



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

ARC
Guest
 
Posts: n/a
#3: Jul 13 '07

re: .Undo for unbound controls?


Yes, the ExportedYN is the control name, and it is a checkbox. I tried
setting it back to ExportedYN = 0, but it didn't work...


"Bob Quintal" <rquintal@sPAmpatico.cawrote in message
news:Xns996C9AB843E3EBQuintal@66.150.105.47...
Quote:
"ARC" <andy@andyc.comwrote in
news:BYPli.18884$Rw1.12488@newssvr25.news.prodigy. net:
>
Quote:
>I've noticed that if you use code for the before update
>command for unbound controls, it doesn't really work.
>>
>I tried the following:
>>
>Me!ExportedYN.undo
>Cancel = True
>DoCmd.CancelEvent
>Exit Sub
>>
>However, putting the above code in the before update on
>unbound controls does NOT undo their typing. Does anyone know
>the proper way for unbound controls?
>>
>Many Thanks,
>>
The reason is that the before update event may reject an entry
because of a spelling misteak and users get annoyed if they have
to retype the whole mistake instead of just editing the
previously typed data.
>
In addition to the Cancel = true statement,
put me.ExportedYN.text = ""
(I'm guessing that ExportedYN is your control name. .
>
>
>
--
Bob Quintal
>
PA is y I've altered my email address.
>
--
Posted via a free Usenet account from http://www.teranews.com
>

Bob Quintal
Guest
 
Posts: n/a
#4: Jul 13 '07

re: .Undo for unbound controls?


"ARC" <andy@andyc.comwrote in
news:3GQli.46223$5j1.38221@newssvr21.news.prodigy. net:
Quote:
Yes, the ExportedYN is the control name, and it is a checkbox.
I tried setting it back to ExportedYN = 0, but it didn't
work...
>
Ok, I misinterpreted your statement about " before update on
unbound controls does NOT undo their typing." since you don't
type anything into a checkbox.

Maybe if I understood more about what triggers the need to undo
the checkbox I might be able to offer better suggestions.


Quote:
>
"Bob Quintal" <rquintal@sPAmpatico.cawrote in message
news:Xns996C9AB843E3EBQuintal@66.150.105.47...
Quote:
>"ARC" <andy@andyc.comwrote in
>news:BYPli.18884$Rw1.12488@newssvr25.news.prodigy .net:
>>
Quote:
>>I've noticed that if you use code for the before update
>>command for unbound controls, it doesn't really work.
>>>
>>I tried the following:
>>>
>>Me!ExportedYN.undo
>>Cancel = True
>>DoCmd.CancelEvent
>>Exit Sub
>>>
>>However, putting the above code in the before update on
>>unbound controls does NOT undo their typing. Does anyone
>>know the proper way for unbound controls?
>>>
>>Many Thanks,
>>>
>The reason is that the before update event may reject an
>entry because of a spelling misteak and users get annoyed if
>they have to retype the whole mistake instead of just editing
>the previously typed data.
>>
>In addition to the Cancel = true statement,
>put me.ExportedYN.text = ""
>(I'm guessing that ExportedYN is your control name. .
>>
>>
>>
>--
>Bob Quintal
>>
>PA is y I've altered my email address.
>>
>--
>Posted via a free Usenet account from http://www.teranews.com
>>
>
>
>


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Marshall Barton
Guest
 
Posts: n/a
#5: Jul 13 '07

re: .Undo for unbound controls?


ARC wrote:
Quote:
>I've noticed that if you use code for the before update command for unbound
>controls, it doesn't really work.
>
>I tried the following:
>
>Me!ExportedYN.undo
>Cancel = True
>DoCmd.CancelEvent
>Exit Sub
>
>However, putting the above code in the before update on unbound controls
>does NOT undo their typing. Does anyone know the proper way for unbound
>controls?

Unbound controls do not have a "previous" value (that is in
the original current record), so Undo is meaningless (in the
context of its definition).

Can't you use the AfterUpdate event and just set the value
to a known value?

Note that in your code above, Cancel = True and CancelEvent
are equivalent and using both is redundant. Cancel = True
is the recommended approach.

--
Marsh
ARC
Guest
 
Posts: n/a
#6: Jul 14 '07

re: .Undo for unbound controls?


Thanks to both of you!

The need to undo the checkbox is because I have the detail showing repeating
lines, so the repeating lines are bound controls. The form header controls
are all unbound, and I'm saving them via code (since I can't have 2 records
sources, I have to do unbound in for the header controls). The checkbox is a
Taxexempt switch that saves with the header area.

If you want more detail:

Header controls are for a table called Invoices which contain the main
options for the invoice, like date, invoice number, tax exempt (checkbox),
etc. I have them all unbound, and am saving the data manually via code.

Detail controls are bound and use the table InvoiceDetail.

Wish there was a way to do a different record source for the header and
details, but you can't.

Hope that makes more sense,

"Bob Quintal" <rquintal@sPAmpatico.cawrote in message
news:Xns996CA6EDBC409BQuintal@66.150.105.47...
Quote:
"ARC" <andy@andyc.comwrote in
news:3GQli.46223$5j1.38221@newssvr21.news.prodigy. net:
>
Quote:
>Yes, the ExportedYN is the control name, and it is a checkbox.
>I tried setting it back to ExportedYN = 0, but it didn't
>work...
>>
Ok, I misinterpreted your statement about " before update on
unbound controls does NOT undo their typing." since you don't
type anything into a checkbox.
>
Maybe if I understood more about what triggers the need to undo
the checkbox I might be able to offer better suggestions.
>
>
>
Quote:
>>
>"Bob Quintal" <rquintal@sPAmpatico.cawrote in message
>news:Xns996C9AB843E3EBQuintal@66.150.105.47...
Quote:
>>"ARC" <andy@andyc.comwrote in
>>news:BYPli.18884$Rw1.12488@newssvr25.news.prodig y.net:
>>>
>>>I've noticed that if you use code for the before update
>>>command for unbound controls, it doesn't really work.
>>>>
>>>I tried the following:
>>>>
>>>Me!ExportedYN.undo
>>>Cancel = True
>>>DoCmd.CancelEvent
>>>Exit Sub
>>>>
>>>However, putting the above code in the before update on
>>>unbound controls does NOT undo their typing. Does anyone
>>>know the proper way for unbound controls?
>>>>
>>>Many Thanks,
>>>>
>>The reason is that the before update event may reject an
>>entry because of a spelling misteak and users get annoyed if
>>they have to retype the whole mistake instead of just editing
>>the previously typed data.
>>>
>>In addition to the Cancel = true statement,
>>put me.ExportedYN.text = ""
>>(I'm guessing that ExportedYN is your control name. .
>>>
>>>
>>>
>>--
>>Bob Quintal
>>>
>>PA is y I've altered my email address.
>>>
>>--
>>Posted via a free Usenet account from http://www.teranews.com
>>>
>>
>>
>>
>
>
>
--
Bob Quintal
>
PA is y I've altered my email address.
>
--
Posted via a free Usenet account from http://www.teranews.com
>

Marshall Barton
Guest
 
Posts: n/a
#7: Jul 14 '07

re: .Undo for unbound controls?


ARC wrote:
Quote:
>The need to undo the checkbox is because I have the detail showing repeating
>lines, so the repeating lines are bound controls. The form header controls
>are all unbound, and I'm saving them via code (since I can't have 2 records
>sources, I have to do unbound in for the header controls). The checkbox is a
>Taxexempt switch that saves with the header area.
>
>If you want more detail:
>
>Header controls are for a table called Invoices which contain the main
>options for the invoice, like date, invoice number, tax exempt (checkbox),
>etc. I have them all unbound, and am saving the data manually via code.
>
>Detail controls are bound and use the table InvoiceDetail.
>
>Wish there was a way to do a different record source for the header and
>details, but you can't.

Seems like you a taking the road up and down the mountain
instead of just walking around the rocks ;-)

Is there a good reason why you are not using a subform for
the invoice details? This way the main form can be bound to
the Invoice record.

--
Marsh
ARC
Guest
 
Posts: n/a
#8: Jul 14 '07

re: .Undo for unbound controls?


Yes, because I'm trying the new Access 2007 split form. This way, I can use
one form and have the header area look nice and presentable, and still
utilize a datasheet type view in the detail. So if the user maximizes the
form, and is using a big resolution, the datasheet will fill the screen,
which my user's want. I've found if you use a subform, it won't auto-expand,
unless you code it on the resize event.


"Marshall Barton" <marshbarton@wowway.comwrote in message
news:cv4g93h258ihvll0fejjtl6ainb0c47re1@4ax.com...
Quote:
ARC wrote:
Quote:
>>The need to undo the checkbox is because I have the detail showing
>>repeating
>>lines, so the repeating lines are bound controls. The form header controls
>>are all unbound, and I'm saving them via code (since I can't have 2
>>records
>>sources, I have to do unbound in for the header controls). The checkbox is
>>a
>>Taxexempt switch that saves with the header area.
>>
>>If you want more detail:
>>
>>Header controls are for a table called Invoices which contain the main
>>options for the invoice, like date, invoice number, tax exempt (checkbox),
>>etc. I have them all unbound, and am saving the data manually via code.
>>
>>Detail controls are bound and use the table InvoiceDetail.
>>
>>Wish there was a way to do a different record source for the header and
>>details, but you can't.
>
>
Seems like you a taking the road up and down the mountain
instead of just walking around the rocks ;-)
>
Is there a good reason why you are not using a subform for
the invoice details? This way the main form can be bound to
the Invoice record.
>
--
Marsh

Closed Thread