Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 03-26-2009, 02:20 AM   #1
BPBP
Registered User
 
Join Date: Feb 2009
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
BPBP is on a distinguished road
recordsetType property from snapshot to dynaset

I have a Main form(frmHistMain) and a sub form. by default, recordset type property of the main form is set to snapshot. and record locks set to all records. Hence the user cannot change anything.

my concept is to have a button to unlock the form, so the recordset property is to change to dynaset so that i can edit the form and its subform.

I have placed this a button on the form and put this 2 line code into the button on click event.

Forms!frmHistMain.RecordLocks = 0
Forms!frmHistMain.RecordsetType = 0

When i click the button, i note that the form refreshes, but when i try to select a field and edit, it beeps and does not allow edits. However if i manually go into design view and alter the record lock and recordset type property to no locks and dynaset and go back to form view, the button works as intended.

What is wrong?

BPBP is offline   Reply With Quote
Old 03-26-2009, 03:32 AM   #2
DCrake
Administrator
 
DCrake's Avatar
 
Join Date: Jun 2005
Location: Burnley, Lancashire
Posts: 8,634
Thanks: 8
Thanked 305 Times in 207 Posts
DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light DCrake is a glorious beacon of light
Send a message via Skype™ to DCrake
Re: recordsetType property from snapshot to dynaset

I think you will find that you can only change this property in design mode not in view mode.
__________________
David Crake


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
The Home of Simple Software Solutions.

O/S Windows XP (SP3) & Windows 7 64bit
Access 2003 (version 11.0)
Access 2007 (version 12.0)

Remember when posting sample databases you will get a better response if it is pre Access 2007 - not all people have it installed.
DCrake is offline   Reply With Quote
Old 03-27-2009, 09:08 PM   #3
BPBP
Registered User
 
Join Date: Feb 2009
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
BPBP is on a distinguished road
Re: recordsetType property from snapshot to dynaset

Quote:
Originally Posted by DCrake View Post
I think you will find that you can only change this property in design mode not in view mode.
ooh okay so its not possible to do this with a button. Thanks.

BPBP is offline   Reply With Quote
Old 03-28-2009, 07:03 AM   #4
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,371
Thanks: 51
Thanked 932 Times in 902 Posts
gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light
Re: recordsetType property from snapshot to dynaset

you are better to base the form on a dynaset, but set enableedits to false

then you cant edit anything

but you can change enableedits to true in code

me.enableedits = true, which "unlocks" the form.
__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the top right of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Old 03-29-2009, 06:22 PM   #5
BPBP
Registered User
 
Join Date: Feb 2009
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
BPBP is on a distinguished road
Re: recordsetType property from snapshot to dynaset

Quote:
Originally Posted by gemma-the-husky View Post
you are better to base the form on a dynaset, but set enableedits to false

then you cant edit anything

but you can change enableedits to true in code

me.enableedits = true, which "unlocks" the form.

I have a searchbox to retrieve the correct record at the header of the form. If i set enableedits to false, the user cannot use the searchbox to retrieve the record.

The original intention of this form is just for viewing only. The user only require to key in the id number and hit enter, the rest of the controls fills up with the information but these information should not be editable to prevent "accidents" from happening.

I was thinking of first setting the enableedit to false, and when the mouse moves over the search button, set me.enableedits = true. And then when the mouse moves off the search button, set me.enableedits = false.

Is there a mouse off event or alternative event?
BPBP is offline   Reply With Quote
Old 03-30-2009, 02:10 AM   #6
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,371
Thanks: 51
Thanked 932 Times in 902 Posts
gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light gemma-the-husky is a glorious beacon of light
Re: recordsetType property from snapshot to dynaset

in that case,

set all the forms controls as enabled=true
locked=false then

when you open the form call this sub.
it will run without noticeable delay

Code:
sub lockfields
dim ctrl as control

from each ctrl in me.controls
  if ctrl.name<>"unlockedfield" then
     ctrl.locked=true
  end if
next
end sub

__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the top right of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2002 -> 2007 dao ado argh! Babbage Modules & VBA 9 05-31-2009 07:51 PM
Not able to pass array as an argument to Let Property kapil Modules & VBA 1 01-30-2007 11:28 AM
Winamp and Access raindrop3 Modules & VBA 24 04-04-2006 03:57 PM
Statements and lables invalid between Select case and first case? snicker Modules & VBA 5 02-04-2004 06:53 AM
Custom Property dynamictiger Modules & VBA 0 02-28-2003 06:00 PM




All times are GMT -8. The time now is 07:13 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World