473,796 Members | 2,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with some VB Code

Here is what I have so far, it loops while the PW is incorrect, or
until cancel is selected. I want it to lock the tables for adds,
deletes, and edits when cancel is selected, and if the PW is correct.

I want this to run when the DB is opened, I would also like the text
box to be starred (*) out when text is input.

Thanks for your help.

=============== ===============
Dim Show_Box As Boolean
Dim Response As String

' Set the Show_Dialog variable to True.
Show_Box = True
InputBox
' Begin While loop.
While Show_Box = True

' Show the input box.
Response = InputBox("Enter the Password to Unlock Read-Only
Mode.", _
"Read-Only Unlocking")
' See if Cancel was pressed.
If Response = "" Then

' If Cancel was pressed,
' break out of the loop.
Show_Box = False
Else
' Test Entry to find out if it is the correct password.
If "safety" = Response = True Then
'Application.Cl oseCurrentDatab ase
'Application.DB Engine.OpenData base "P:\ACTION REGISTER
\TESTERIncidet Action Register Database.mdb", , True
'Application.Op enCurrentDataba se "P:\ACTION REGISTER
\TESTERIncidet Action Register Database.mdb", False
'Access.AcOpenD ataMode.acReadO nly
Show_Box = False
Else
' If the entry was wrong, show an error message.
MsgBox "Wrong Password, Try again."
End If
End If
' End the While loop.
Wend
=============== =============== =============== =
Jun 27 '08
15 2076
Application.Clo seCurrentDataba se
Application.DBE ngine.OpenDatab ase "P:\ACTION REGISTER
\TESTERIncidet Action Register Database.mdb", , True

This code runs within the current database.
The first line closes the current database.
How can the second line run when the its application is closed?

!!!!!Perhaps!!! !! this is what Rich P is talking about when he
suggests that multi-threading is required to make this work.

In any case this reminds me of the problem around compacting the
current db from code in earlier versions of Access. We must close the
db and then compact. Once we close the db, the rest of the code, the
compacting, never runs. Hacks for this, my own included, create and
open, in code, a second db which is populated with the information
required to compact and then reopen the first and close itself; that
db is coded to do exactly that on open; all that is required is a few
seconds sleep. I suspect that if it were worthwhile to do so,
something like that could be cobbled up for this situation.

But why would one do this? It's been my experience that application-
level security is no security at all. If one wants to restrict the
editing of forms one can run a standard procedure on opening all forms
taking the form as a parameter, which checks some database property or
global variable established on opening and sets the allow edits,
insets properties appropriately. With an MDE and some window hiding
this can prevent casual unauthorized editing.

There are various levels of JET security that can be achieved. Almost
all can be beaten, and it's a trivial task to beat most.


Jun 27 '08 #11
lyle fairfield <ly************ @gmail.comshoul d have written in
news:78******** *************** ***********@m36 g2000hse.google groups.com:
Application.Clo seCurrentDataba se
Application.DBE ngine.OpenDatab ase "P:\ACTION REGISTER
\TESTERIncidet Action Register Database.mdb", , True

This code runs within the current database.
The first line closes the current database.
How can the second line run when the database where the code (pcode)
exists, is closed?
Jun 27 '08 #12
On May 7, 7:01*am, lyle fairfield <lylef...@yah00 .cawrote:
lyle fairfield <lyle.fairfi... @gmail.comshoul d have written innews:78****** *************** *************@m 36g2000hse.goog legroups.com:
Application.Clo seCurrentDataba se
Application.DBE ngine.OpenDatab ase "P:\ACTION REGISTER
\TESTERIncidet Action Register Database.mdb", , True
This code runs within the current database.
The first line closes the current database.

How can the second line run when the database where the code (pcode)
exists, is closed?
it can't, I tried it, realized I was retarded, and commented it out to
make sure I don't try it again.
Jun 27 '08 #13
colemanj4 <co*******@gmai l.comwrote in
news:05******** *************** ***********@m44 g2000hsc.google groups.com:
On May 7, 7:01*am, lyle fairfield <lylef...@yah00 .cawrote:
>lyle fairfield <lyle.fairfi... @gmail.comshoul d have written
innews:78809
1d************* *************** *@...oglegroups.com:
>>
Application.Clo seCurrentDataba se
Application.DBE ngine.OpenDatab ase "P:\ACTION REGISTER
\TESTERIncidet Action Register Database.mdb", , True
This code runs within the current database.
The first line closes the current database.

How can the second line run when the database where the code (pcode)
exists, is closed?

it can't, I tried it, realized I was retarded, and commented it out to
make sure I don't try it again.
Did it only take once? I tried similar hundreds of times in the late
nineties trying to compact with code.

Jun 27 '08 #14
>>
>The limitation of Interpreted programming
code is that you can't perform OOP operations.

Once again I said the above is incorrect, and there are many interpreted
languages is today that are full oop. And, I pointed out that in fact
the ..net environment relies on a p-code runtime system, very similar to
that of the vba. (and I believe on windows mobile, and also the XNA
system for xbox, there is no JIT either).
<<

Your point is precisely my point --
>>
there are many interpreted languages is today that are full oop
<<

When something cannot be achieved in VBA - or achieved easily
>>there are many interpreted languages is today that are ..
it is time to investigate other technologies. I believe Ruby On Rails
is one of these OOP interpreted languages (OK, I see your point on my
comment about interpreted languages - so I meant just VBA). I don't
happen to be familiar with Ruby except that I don't think it would be as
easy to integrate with Access as a .Net solution. I am fairly familiar
with .Net because I have been using it for the last 6+ years. The
suggestions I provide are all Microsoft based since Access is Microsoft
and just about all the computer technology I use is created by
Microsoft.

Just an aside: sql server 2005/.Net (and sql 2008/.Net more so) is
taking the Access paradigm to the next level where - again - you have an
integrated database development environment - except fully OOP/server
based and supports multiple languages (C# and VB.Net being the most
popular).

Access is kind of like the grandfather of the new(er) database paradigms
Microsoft is developing. And like grandpa, Access is encountering
various limitations. And Microft, I read, is outselling Oracle with its
newer paradigms.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #15
On May 6, 9:56*pm, "Albert D. Kallal" <PleaseNOOOsPAM mkal...@msn.com >
wrote:
Actually, I have to run right now...but, let me take a look at this later
tonight....

I do think something can be cooked up here.....

--
Albert D. Kallal * *(Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKa l...@msn.com

Below is what I have now, I have defined the function
'NetworkUserNam e' to return the login name of the user. I want (where
the comments are) to change their user type (as defined in the *.ldb)
to be User instead of Admin, as User only has read only access to the
DB.

Been searching how to do that and can't find it, any help you could
provide would be awesome.
Sub LockDB()

Dim Show_Box As Boolean
Dim Response As String
Dim userName As String

userName = NetworkUserName ()

Show_Box = True

While Show_Box = True

Response = InputBox("Enter the Password for Admin. Cancel to
Enter as Read-Only", _
"Read-Only Unlocking")

'See if Cancel was pressed.
If Response = "" Then

'Set userName to the User group HERE
MsgBox "You can look at anything, but change nothing"
Show_Box = False
Else
'Test Entry to find out if it is the correct password.
If ("safety" = Response) Then

MsgBox "You are granted Admin rights"
'set userName to the Admin group HERE
Show_Box = False

Else

' If the entry was wrong, show an error message.
MsgBox "Wrong Password, Try again."

End If
End If
Wend

End Sub

Thanks
Jun 27 '08 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2758
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like storing products in
3
1593
by: Mike | last post by:
Hey guys I am pulling my hair out on this problem!!!!! Any help or ideas or comments on how to make this work I would be grateful! I have been working on this for the past 4 days and nothing I do seems to get me any closer to the solution. Below is a program that I am working on for a class project. The original code was provided for us which is what I have below. What we have to do is make the app run so that it allows the user to add...
8
3024
by: MattP | last post by:
Ok, with the help of some examples found on the web and some minor modifications on our own, we have a simple and working encrypt and decrypt solution. It runs as a service, watches for files with a specific extension in a specific directory. The files are uploaded by FTP to this directory. The service then does the following steps: 1) Verify it can open the file (so we know it's fully uploaded). 2) Try to decrypt the file with known...
28
3308
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
16
2593
by: expertware | last post by:
Dear friends, My name is Pamela, I do not know anything about javascript, but I would like to ask if it offers a solution to this problem of mine. I have an image on a web page within a css layer: <DIV ID=MyLayer STYLE = "position: absolute;top:68px; left:563px;
23
3290
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application to create certain textboxes, labels, and combo boxes? Any ideas would be appreciated. Thanks
3
3741
by: inkexit | last post by:
I need help figuring out what is wrong with my code. I posted here a few weeks ago with some code about creating self similar melodies in music. The coding style I'm being taught is apparently a lot different from what the pros around here use. I really need help with debugging some program errors more than anything, even though my coding style might not be perfect. Anyway here is my code. About the only things that work right are...
16
2820
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and efficient navigating within Visual Studio 2005. Let's say your project (or solution) has dozens of forms and hundreds or even thousands of routines. Two Questions: 1) BUILT-IN to Visual Studio 2005. What ideas do you have to quickly
15
2584
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
0
5577
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10465
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10242
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.