Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 April 2nd, 2009, 03:00 AM
Authorized User
 
Join Date: Nov 2008
Posts: 21
Thanks: 3
Thanked 0 Times in 0 Posts
Send a message via MSN to MonkeyMan666
Default Changing DataEntry property programtically

Hiya,

I am using a MS Access 2003 ADP Project which connects to a SQL Server 2005 (this maybe the cause of the problem I don't know).

I want to toggle the "DataEntry" property of the forms depending on who is logged in. My code looks up an Admin field from a table containing users and if they have admin rights then I want to make DataEntry false.

My code is:
Code:
    If isAdmin = True Then
        Forms!frmSecondments.DataEntry = False
        Forms!frmSecondments.NavigationButtons = True
    Else
        Forms!frmSecondments.DataEntry = True
        Forms!frmSecondments.NavigationButtons = False
    End If
The navigation buttons are being toggled ok and as I am not getting any error messages I think it could be the record source.

Does anyone have any ideas?

Thanks in advance
 
Old April 2nd, 2009, 03:12 AM
Authorized User
 
Join Date: Nov 2008
Posts: 21
Thanks: 3
Thanked 0 Times in 0 Posts
Send a message via MSN to MonkeyMan666
Default

I have found out that the problem is when the form is opened with a filter.

My filter string is something like "Division = 1 OR Division IS NULL"

When I use this a query it works fine but opening it with the form stops the data entry from being modified.

Last edited by MonkeyMan666; April 2nd, 2009 at 06:27 AM.. Reason: The fix didnt work
 
Old April 2nd, 2009, 04:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

You can use the following form properties: Allow Additions, Allow Deletions, Allow Edits.

e.g. Me.AllowEdits = isAdmin

You can use the following control property: Locked

e.g. Me.txtName.Locked = Not isAdmin
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
changing the backcolor property of the textbox Fehrer Access VBA 9 April 19th, 2016 10:59 AM
Changing the BackColor property of a Form Qman69 Visual Basic 2005 Basics 0 March 14th, 2007 04:43 PM
changing property doesn't work Vanni VB.NET 4 July 1st, 2005 07:50 AM
Changing Control Property from another Frame Wandha ASP.NET 1.0 and 1.1 Basics 4 August 8th, 2003 01:34 AM
Changing Control Property from another Frame Wandha Forum and Wrox.com Feedback 1 August 5th, 2003 07:43 AM





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