A better mouse trap? (1 Viewer)

Rx_

Nothing In Moderation
Local time
Yesterday, 18:43
Joined
Oct 22, 2009
Messages
2,803
Really enjoyed walking through your code!! Thanks!
After maintaining vba unbound controls for two years, the current assignment is to maintain some one elses code (or lack of it) with no validation at any level, leaving the records with lots of nulls. While I have been able to justify a few new buttons, the basic orders are to "keep it looking the same".
Well, your code example brought to mind something I had not though about.
And that is the Form Cycle property
My project uses All Records - that may explain some unintended events I have been experiencing from time to time.
EXAMPLE: use the Cycle property to specify what happens when you press the TAB key and the focus is in the last control on a bound form. Read/write Byte.
expression.Cycle
expression Required. An expression that returns one of the objects in the Applies To list. For the benefit of others:
The Cycle property uses the following settings.
SettingVBDescriptionAll Records0(Default) Pressing the TAB key from the last control on a form moves the focus to the first control in the tab order in the next record.Current Record1Pressing the TAB key from the last control on a record moves the focus to the first control in the tab order in the same record.Current Page2Pressing the TAB key from the last control on a page moves the focus back to the first control in the tab order on the page.

Note You can set the Cycle property by using the form's property sheet , a macro , or Visual Basic .
 

kristy10

New member
Local time
Yesterday, 17:43
Joined
Dec 14, 2010
Messages
8
Hi, (Sorry my english is bad :D)

I use Access 2007.
I have form and subform, and I try create a save bouton, but my code save only my form and not my subform.
so, I try apply your idea, but i dont find where i can change your code for save my fields of subform with my form
 

RuralGuy

AWF VIP
Local time
Yesterday, 18:43
Joined
Jul 2, 2005
Messages
13,826
Records of SubForms are automatically saved when you move the focus back to the MainForm.
 

kristy10

New member
Local time
Yesterday, 17:43
Joined
Dec 14, 2010
Messages
8
Yes I know but I want do that manual, not automatically
 

RuralGuy

AWF VIP
Local time
Yesterday, 18:43
Joined
Jul 2, 2005
Messages
13,826
Then you will probably want to explore transactions or temporary tables.
 

kristy10

New member
Local time
Yesterday, 17:43
Joined
Dec 14, 2010
Messages
8
no, but e.g, i modify all records (Mainform and Subform) then i click in cancel, so records of Mainform are not saved but records of Subform are automatically saved.
 

RuralGuy

AWF VIP
Local time
Yesterday, 18:43
Joined
Jul 2, 2005
Messages
13,826
You could then delete all of the records in the Temp table or revert the Transactions.
 

kristy10

New member
Local time
Yesterday, 17:43
Joined
Dec 14, 2010
Messages
8
THx again,
A better mouse trap: is good example :)
Bravo, good work
 

Gaccesses

Registered User.
Local time
Yesterday, 17:43
Joined
Mar 13, 2012
Messages
40
For some reason, each time I download this zip file. I get a popup that says, "you are about to open a read only file", then nothing shows up at all. Any help? Upload pls? Thanks
 

Gaccesses

Registered User.
Local time
Yesterday, 17:43
Joined
Mar 13, 2012
Messages
40
I think, I am unzipping? so maybe I am not? How can I from this download? it is not an immediate option.

i have windows 7
 
Last edited:

RuralGuy

AWF VIP
Local time
Yesterday, 18:43
Joined
Jul 2, 2005
Messages
13,826
After you download you need to RightClick the file and go to Properties and "Unblock" the file. Then RightClick and "Extract" the contents of the zip file.
 

ryetee

Registered User.
Local time
Today, 01:43
Joined
Jul 30, 2013
Messages
952
I hope ghudson is still about!!
I'm having a load of problems validating a form and then skipping to the enxt record and this seems like it may be of help but I've got access 2016 and it's refusing to open a previous version
Any chance in someone that has an old version of access saving this as a later version or at least an accdb?
 

isladogs

MVP / VIP
Local time
Today, 01:43
Joined
Jan 14, 2017
Messages
18,247
I don't know if he is but he last posted in June 2018

I've converted the old MDB file to ACCDB & fixed a layout issue in A2019 but otherwise have made no changes to the code

I've never tried it before but it seems to work OK
Hopefully you can now decide whether it solves your issue

Attached zip file contains the original MDB & ACCDB conversion
 

Attachments

  • mousetrap.zip
    158.4 KB · Views: 154

ryetee

Registered User.
Local time
Today, 01:43
Joined
Jul 30, 2013
Messages
952
I don't know if he is but he last posted in June 2018

I've converted the old MDB file to ACCDB & fixed a layout issue in A2019 but otherwise have made no changes to the code

I've never tried it before but it seems to work OK
Hopefully you can now decide whether it solves your issue

Attached zip file contains the original MDB & ACCDB conversion

Thanks so much. I've just dug out an old laptop which has an earlier version but I think it's steam driven and it's taken 30 minutes to boot it up and get chrome to open!!
 

Users who are viewing this thread

Top Bottom