Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2005, 06:56 PM
Authorized User
 
Join Date: Feb 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms question

Hi all, thanks to those who helped me on the previous post, makes it alot clearer. I have been creating forms for my current assignment which is working quite well. Whenever i go back to a form, I notice that you can change any of the previously entered data, I have already done this accidently a couple of times. Is there anyway that once you have entered a form, the next time you want to change that page you have to press an edit button? For example, using the members list, a member enters all their details and the next member to use the database could ammend any of the previous information entered. It would be nice for the page to be read only once the data was entered, unless you pressed an edit button. Can anyone help???????? Jason

 
Old February 17th, 2005, 07:39 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

You can set no-cache option on top of your page.

Please check the following options:
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>

http://www.learnasp.com/learn/cachenomore.asp


Om Prakash
 
Old February 17th, 2005, 11:15 PM
Authorized User
 
Join Date: Feb 2005
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Jason

Maybe I didn't understand your question looking at the reply Om gave you but in case you are talking about an Access form in a .mdb file try the following:

Set the AllowEdits form's property to false (this way is is impossible to change the data) and add the following code to your OnCurrent form event:

Private Sub Form_Current()
    If Me.NewRecord Then
        Me.AllowEdits = True
    Else
        Me.AllowEdits = False
    End If
End Sub

So, only when you're a new record you can change it.

Now add the following code to the OnClick event of a Command button:

Private Sub cmdEdit_Click()
    Me.AllowEdits = Not Me.AllowEdits
    If Me.AllowEdits Then
        Me.Caption = Me.Caption & " (Edit Mode)"
    Else
        Me.Caption = Me.Caption & " (Read Only)"
    End If
End Sub

There you go. Click the button to allow editing of the current record only. Move to another record and it becomes read only again. The Caption stuff is there only to make it more clear for the users what mode they are in.

Hope this helped
Daniel

Daniel
 
Old February 18th, 2005, 05:01 PM
Authorized User
 
Join Date: Feb 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks to all for the help. Much appreciated.

Jason






Similar Threads
Thread Thread Starter Forum Replies Last Post
question about forms danastasio Classic ASP Databases 0 October 1st, 2007 01:04 PM
continuous forms question hamffjs Access 3 January 29th, 2007 01:33 PM
Forms Question biglazy Access 3 December 23rd, 2005 12:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.