Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

RecordsetType Property

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 16 Nov 2006 13:37 GMT
Hello,

I am trying to understand the use of the RecordsetType property.

I place the statement

If me.CurrentRecord>1 Then
  Me.RecordsetType=2
Else
  Me.RecordsetType=0
End if

If the Form Current Event.  However, this seem to have completely messed up
the db as it now seems to run code endlessly and never finishes opening the
form.  i alwasy end up having to halt the code execution.  Could someone
explain why what I thought was a simple IF statement make the db loop like
that?  Also, is there a work around?

Thank you,

Daniel
Roger Carlson - 16 Nov 2006 14:31 GMT
According to Help:
"Note:   Changing the RecordsetType property of an open form or report
causes an automatic recreation of the recordset."

This sets the CurrentRecord back to 1 and reinitiates the Form Current
event, which loops again, causing an endless loop.

Signature

--Roger Carlson
 MS Access MVP
 Access Database Samples: www.rogersaccesslibrary.com
 Want answers to your Access questions in your Email?
 Free subscription:
 http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

> Hello,
>
[quoted text clipped - 17 lines]
>
> Daniel
Dirk Goldgar - 16 Nov 2006 18:45 GMT
> Hello,
>
[quoted text clipped - 13 lines]
> execution.  Could someone explain why what I thought was a simple IF
> statement make the db loop like that?  Also, is there a work around?

Roger explained what's going on.  For a workaround, what are you trying
to achieve, in a practical sense?  If you just want to make the form
read-only, you can do it by setting its AllowEdits, AllowAdditions, and
AllowDeletions properties to False.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Daniel - 17 Nov 2006 02:41 GMT
First off, Thank you Roger for the explanation!

Dirk,  I have been asked to lock previous record but leave the most recent
open for editing.  Thus record 1 should be dynaset and any other snapshot (in
my mind at least...).  I did try the allowedits but it still permited my
users to make entries because they could still activate the double-click
event which opens a calendar and programatically made changes. Any
suggestions?

Thank you both once again.

Daniel

> > Hello,
> >
[quoted text clipped - 18 lines]
> read-only, you can do it by setting its AllowEdits, AllowAdditions, and
> AllowDeletions properties to False.
Dirk Goldgar - 17 Nov 2006 04:52 GMT
> First off, Thank you Roger for the explanation!
>
[quoted text clipped - 4 lines]
> still activate the double-click event which opens a calendar and
> programatically made changes. Any suggestions?

I'm not sure what you mean by "most recent" -- whether you just want to
let users add records but not edit records that have previously been
saved, or whether you have something more complicated in mind -- but I
stil think your best bet is to manipulate the form's AllowEdits and
AllowDeletions properties.  If you have an event procedure that modifies
a record using code, surely you can test in that procedure whether the
modification should be allowed or not, and simply refuse to do it.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.