i have created a database using excel and i have to set a security level i have written all of the vba code correctly i think but it just does seem to work properly. here is the code below if anyone could point out any problems with it would be much appreciated. -
-
Private Sub Login_Click()
-
Dim name, password, found, loops
-
found = 0
-
loops = 0
-
name = Range("Username").Value
-
password = Range("Password").Value
-
Worksheets("Data").Visible = True
-
Worksheets("Data").Select
-
ActiveSheet.Range("A1").Activate
-
While ActiveCell.Offset(loops, 0).Value <> "" And found = 0
-
If Username = ActiveCell.Offset(loops, 0).Value Then
-
If password = ActiveCell.Offset(loops, 1).Value Then
-
found = 1
-
End If
-
End If
-
loops = loops + 1
-
Wend
-
If found = 0 Then
-
Worksheets("Login").Select
-
Worksheets("Data").Visible = True
-
MsgBox ("Logon Failed")
-
Worksheets("Lowlev").Visible = False
-
Workbooks("Unit10assisgnment.xls").Close SaveChanges:=False
-
End If
-
Worksheets("Lowlev").Visible = True
-
Worksheets("Lowlev").Select
-
ActiveWindow.DisplayWorkbookTabs = True
-
-
End Sub
-
2 1956
i have created a database using excel and i have to set a security level i have written all of the vba code correctly i think but it just does seem to work properly. here is the code below if anyone could point out any problems with it would be much appreciated. -
-
Private Sub Login_Click()
-
Dim name, password, found, loops
-
found = 0
-
loops = 0
-
name = Range("Username").Value
-
password = Range("Password").Value
-
Worksheets("Data").Visible = True
-
Worksheets("Data").Select
-
ActiveSheet.Range("A1").Activate
-
While ActiveCell.Offset(loops, 0).Value <> "" And found = 0
-
If Username = ActiveCell.Offset(loops, 0).Value Then
-
If password = ActiveCell.Offset(loops, 1).Value Then
-
found = 1
-
End If
-
End If
-
loops = loops + 1
-
Wend
-
If found = 0 Then
-
Worksheets("Login").Select
-
Worksheets("Data").Visible = True
-
MsgBox ("Logon Failed")
-
Worksheets("Lowlev").Visible = False
-
Workbooks("Unit10assisgnment.xls").Close SaveChanges:=False
-
End If
-
Worksheets("Lowlev").Visible = True
-
Worksheets("Lowlev").Select
-
ActiveWindow.DisplayWorkbookTabs = True
-
-
End Sub
-
Hi. Perhaps the thing that is most evident here is the last part of your code -
If found = 0 Then
-
Worksheets("Login").Select
-
Worksheets("Data").Visible = True
-
MsgBox ("Logon Failed")
-
Worksheets("Lowlev").Visible = False
-
Workbooks("Unit10assisgnment.xls").Close SaveChanges:=False
-
End If
-
Worksheets("Lowlev").Visible = True
-
Worksheets("Lowlev").Select
-
ActiveWindow.DisplayWorkbookTabs = True
-
Can you explain what this line does?
Workbooks("Unit 10assisgnment.x ls").Close SaveChanges:=Fa lse
whne the incorrect details have been entered it will close the workbook and i choose whether i want to save the changes that have made to the workbook before it closes.
i have to set to false so it doesnt save the changes that have been made when the wrong password and username are entered.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jeremy Langworthy |
last post by:
Hi
I am trying to create a MS Excel format CSV but I can't figure out how
to get the line feed/carriage return/new record working properly.
I am nding each line/record with these characters: "\r\n" but the
Excel file just loads all the field in one row as if it doesn't
recognise these characters.
These are the headers I am using to create the file:
|
by: Andy |
last post by:
Hi,
Please help, I'm getting desperate. Any ideas warmly welcomed!
I'm trying to read from a basic excel file (1000 or so rows from
column A) but am having problems. The code I am using is:
Declare @Return Int
SET NOCOUNT ON
Exec @Return= .. 'READ_XLS', 'EXCEL',
'Microsoft.Jet.OleDB.4.0' , 'e:\jsbackup\RACodes.xls',
|
by: Guy Incognito |
last post by:
Hello,
I've written an asp.net application that creates Excel documents. It
works by creating an excel document in XML format.
But I wonder if I'm reinventing the wheel. I know that there are ways to
read and write Excel files with ADO, but as far as I can tell, it
doesn't provide the flexibility I need. I need to be able to generate
tabs, cell formatting, formulas, etc.
|
by: Paul |
last post by:
Hi all
Arggghhh...........
The problem.....I want the user to be able to create an excel document and
name particular cells in the document where they want the data to be placed
and then save this out of an XML file or Excel Template file.
Next I need to convert a dataset to xml and try and transform this data into
the users xml file..........i've seen a few things on this but havent had
much success...
|
by: Ronald Snelgrove |
last post by:
To All:
I am a newbie to VB.net and am writing an application in VB.net in which I
successfully create an Excel sheet, tabulate and format some data on a sheet
titled "summarySheet".
A difficulty arises when I try to define where a page break should be. I
need to fit a landscape table on one sheet. I thought that "telling" Excel
where the vertical page break is would cause it to reduce the zoom factor,
thus fitting the table on one...
| |
by: Paul |
last post by:
Hi I have created an excel file download feature within a .net application
using Microsoft Office XP primary interop assembly for excel. I was just
wondering if anyone knows if you can also embed excel formulas in the excel
download, for example a running total on a column, thanks.
--
Paul G
Software engineer.
|
by: ketz |
last post by:
How do i create a user login for a excel spreadsheet through a userform. I've seem to be able to get a password working but that only lets one passwrod in and its only the password. Ideally what i'd like is a user name and a password with multiple user so that the workbook can be accessed by various user through their own password and username. This is so then i can make a seperate login for the other members of staff who do different jobs in...
|
by: Hendri Adriaens |
last post by:
Hi,
I'm trying to automate the creation of an excel file via COM. I copied my
code below. I read many articles about how to release the COM objects that I
create. The code below runs just fine and excel is closed. But there are
some commented lines:
//xlSeries.XValues = xlWs.get_Range("B2", "B4"); // makes com objects, but
which...
|
by: astolpho |
last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output:
D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise>asant database
Buildfile: build.xml
env-user:
prop-user:
set-user:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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...
|
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
| |
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...
| |