A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

non editable record



 
 
Thread Tools Display Modes
  #1  
Old March 16th, 2010, 08:29 PM posted to microsoft.public.access
Haggr1 via AccessMonster.com
external usenet poster
 
Posts: 28
Default non editable record

how can I make a record non editable if it is "older" than last Thursday

--
Message posted via http://www.accessmonster.com

  #2  
Old March 16th, 2010, 09:09 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 1,555
Default non editable record

Given that someone with a way to fiddle in the tables can change anything,
any time, to be absolutely certain, you'd need to either use Access security
or have your data in a more secure back-end (e.g., SQL Server).

If you're asking how to prevent changes to a record displayed in a form if
that record is older than (?!5 days ago; ?! Thursday, March 11; ???), you
can do that.

We need a bit more specific description to offer more specific
suggestions...

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Haggr1 via AccessMonster.com" u35393@uwe wrote in message
news:a51c19496d209@uwe...
how can I make a record non editable if it is "older" than last Thursday

--
Message posted via http://www.accessmonster.com



  #3  
Old March 16th, 2010, 09:13 PM posted to microsoft.public.access
fredg
external usenet poster
 
Posts: 4,386
Default non editable record

On Tue, 16 Mar 2010 20:29:31 GMT, Haggr1 via AccessMonster.com wrote:

how can I make a record non editable if it is "older" than last Thursday


I assume you wish the 'older' date to change each day.
Code the form's Current event:

If Not Me.NewRecord Then
Me.AllowEdits = Me.ADate = Date - n
Else
Me.AllowEdits = True
End If

where n is the number of days back you wish to use.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #4  
Old March 17th, 2010, 05:42 PM posted to microsoft.public.access
Haggr1 via AccessMonster.com
external usenet poster
 
Posts: 28
Default non editable record

can this be done is the [Table] parameters. I have multiple forms that use
this table. Below is a fucntion I use to find records between Thursday and
Wednesday.

Function LastThurs() As Date
'This will find last Thursday's date
Dim strDates As Date
Dim intDay As Integer
intDay = Weekday(Date) 'Finds today's day of the week
Select Case intDay
Case 1 'Sunday!
strDates = Date - 3
Case 2 'Monday
strDates = Date - 4
Case 3 'Tuesday
strDates = Date - 5
Case 4 'Wednesday
strDates = Date - 6
Case 5 'Thursday
strDates = Date
Case 6 'Friday
strDates = Date - 1
Case 7 'Saturday
strDates = Date - 2
End Select
LastThurs = strDates
End Function


fredg wrote:
how can I make a record non editable if it is "older" than last Thursday


I assume you wish the 'older' date to change each day.
Code the form's Current event:

If Not Me.NewRecord Then
Me.AllowEdits = Me.ADate = Date - n
Else
Me.AllowEdits = True
End If

where n is the number of days back you wish to use.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201003/1

  #5  
Old March 18th, 2010, 08:39 PM posted to microsoft.public.access
Haggr1 via AccessMonster.com
external usenet poster
 
Posts: 28
Default non editable record

Can this code be added to the Table somehow. If so, where?

If [Table1].[Date From] LatsThurs () = True Then
[Table1].[Date From].Allow Edits = No
[Table1].[Date From].AllowDeletions = No
Else
[Table1].[Date From].Allow Edits = Yes
[Table1].[Date From].AllowDeletions = Yes
End If

LastThurs () is as follows:

Function LastThurs() As Date
'This will find last Thursday's date
Dim strDates As Date
Dim intDay As Integer
intDay = Weekday(Date) 'Finds today's day of the week
Select Case intDay
Case 1 'Sunday!
strDates = Date - 3
Case 2 'Monday
strDates = Date - 4
Case 3 'Tuesday
strDates = Date - 5
Case 4 'Wednesday
strDates = Date - 6
Case 5 'Thursday
strDates = Date
Case 6 'Friday
strDates = Date - 1
Case 7 'Saturday
strDates = Date - 2
End Select
LastThurs = strDates
End Function




Haggr1 wrote:
can this be done is the [Table] parameters. I have multiple forms that use
this table. Below is a fucntion I use to find records between Thursday and
Wednesday.

Function LastThurs() As Date
'This will find last Thursday's date
Dim strDates As Date
Dim intDay As Integer
intDay = Weekday(Date) 'Finds today's day of the week
Select Case intDay
Case 1 'Sunday!
strDates = Date - 3
Case 2 'Monday
strDates = Date - 4
Case 3 'Tuesday
strDates = Date - 5
Case 4 'Wednesday
strDates = Date - 6
Case 5 'Thursday
strDates = Date
Case 6 'Friday
strDates = Date - 1
Case 7 'Saturday
strDates = Date - 2
End Select
LastThurs = strDates
End Function

how can I make a record non editable if it is "older" than last Thursday


[quoted text clipped - 8 lines]

where n is the number of days back you wish to use.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201003/1

  #6  
Old March 18th, 2010, 10:21 PM posted to microsoft.public.access
James A. Fortune
external usenet poster
 
Posts: 903
Default non editable record

On Mar 17, 1:42*pm, "Haggr1 via AccessMonster.com" u35393@uwe wrote:
can this be done is the [Table] parameters. *I have multiple forms that use
this table. Below is a fucntion I use to find records between Thursday and
Wednesday.

Function LastThurs() As Date
* * 'This will find last Thursday's date


Find the date of a particular day that is on or before a given date:

Public Function LEDay(dtX As Date, vbDay As Integer) As Date
LEDay = DateAdd("d", -(7 + WeekDay(dtX) - vbDay) Mod 7, dtX)
End Function

Example (Note: vbThursday = 5):

LEDay(#3/17/10#, 5) = 3/11/10
LEDay(#3/18/10#, 5) = 3/18/10
LEDay(#3/19/10#, 5) = 3/18/10

Perhaps loop through some dates using the DateAdd() function to see if
the function gives the same results as yours, then see if it works for
any weekday selected.

James A. Fortune


My parents were factory workers who never went to college.
  #7  
Old March 19th, 2010, 01:49 AM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default non editable record

On Thu, 18 Mar 2010 20:39:07 GMT, "Haggr1 via AccessMonster.com" u35393@uwe
wrote:

Can this code be added to the Table somehow.


Not to the Table, no. Tables have no usable events and table validation rules
cannot call user functions.

You will need to enforce that data is added and edited only through Forms, and
use this code in the appropriate Form event.
--

John W. Vinson [MVP]
  #8  
Old March 19th, 2010, 07:04 PM posted to microsoft.public.access
Haggr1 via AccessMonster.com
external usenet poster
 
Posts: 28
Default non editable record

All of my queries that I use to find records opens with a "datasheet". How
might I protect the records that are "older" than the preceeding "Thursday"
from being edited? Thanks

John W. Vinson wrote:
Can this code be added to the Table somehow.


Not to the Table, no. Tables have no usable events and table validation rules
cannot call user functions.

You will need to enforce that data is added and edited only through Forms, and
use this code in the appropriate Form event.


--
Message posted via http://www.accessmonster.com

  #9  
Old March 19th, 2010, 09:18 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default non editable record

On Fri, 19 Mar 2010 19:04:27 GMT, "Haggr1 via AccessMonster.com" u35393@uwe
wrote:

All of my queries that I use to find records opens with a "datasheet". How
might I protect the records that are "older" than the preceeding "Thursday"
from being edited? Thanks


You can't, in a query datasheet. That's one of many reasons to NOT use query
datasheets for user interaction; if the user can open a table or an editable
query, then they have no barriers to doing anything.
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.