There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen boot bsod computer connection crash css dell display driver drivers email error ethernet excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking nvidia outlook outlook 2003 outlook express partition printer problem router slow software sound trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Trouble with MS Access using VB


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
badnap's Avatar
Junior Member with 5 posts.
 
Join Date: Mar 2005
Experience: Intermediate
24-Mar-2005, 02:11 PM #1
Trouble with MS Access using VB
I am trying to create a filter that is based of the current users login name
so that way you will only certain people will only be allowed to view and edit certain records. I am try to create this in VB and then call it in a query the below is the script that I wrote but it is not working.

Function LoginFilter1()
On Error GoTo LoginFilter1_Err

If (Forms!HIDDENFILTER!LoginName = "login1") Then
DoCmd.ApplyFilter "", """*"""
End If
If (Forms!HIDDENFILTER!LoginName = "login2") Then
DoCmd.ApplyFilter "", """1"" & ""2"" & ""3"""
End If


LoginFilter1_Exit:
Exit Function

LoginFilter1_Err:
MsgBox Error$
Resume LoginFilter1_Exit

End Function


any help would be nice thanks

Badnap
OBP's Avatar
OBP OBP is online now
Computer Specs
Distinguished Member with 6,564 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
27-Mar-2005, 03:14 PM #2
badnap, if you use a form in continuous form mode to display the records of your query then you can use something like this
DoCmd.ApplyFilter , "[Test Number] = 5 or [Test Number] = 8"
where [Test Number] is a field on the form and it is then limited to values of 5 or 8.
I have tested this using a Command Button and it works OK. You would probably need to put it in the forms "on enter" event procedure.
__________________
.
.
OBP
I do not give up easily
coderitr's Avatar
Distinguished Member with 3,080 posts.
 
Join Date: Oct 2003
28-Mar-2005, 11:45 AM #3
You would be better off abandoning MS Access and using MSDE (SQL Server) instead. You can set up tables and columns to have restrictive permissions so that the logged on user is not allowed to edit them. Just my opinion.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:35 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.