473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB6, code refer to access database

1 New Member
Hi, want to ask the following

if rs.fields(0).va lue=text1.text and rs.fields(1).va lue=text2.text then
mainform.show
loginform.hide

As you know, above code is part of Login processing. There are two text boxes for user name and password entry. Number (0) and (1) (in above code) refers to access database fields that user names and passwords are stored there. above code works fine for one user only.

Wondering, how to set for more users and how to extend this code so that anyone whose name,pass is in db, can access to main form. I tried adding fields in db for more usernames but from login form could not refer to them either by field number or data type so, not responding positively.
Thanks in advance
Feb 21 '21 #1
1 13124
MerlinTheGreat
6 New Member
Depending on how many users you have, you can either run through every record of the database table and do the check the way you do in your example, or use a SQL statement to find the username and if found check the password.

Sequentially running through the records until the last, you probably know how to do.
For SQL statements you might have to install an additional database driver to acces the Access database.
SQL is much easier to get and put data into the database.

In SQL you'll use something like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM [Database.Table] WHERE [Table.UserName] EQ Text1.Text
  2. If [Table.Password] = Text2.Text then
  3.   mainform.show
  4.   loginform.hide
  5. End If
If there are more fields in the table than username and password, you can replace the asterisk (*) with the required fieldnames separated by a comma. That way only the listed fields will be loaded.
An asterisk loads all fields of the table.

Hope this gets you started.
Jun 13 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2956
by: lappy | last post by:
Hello, I have written a small programme to compact an access 97 database. Dim je As New JRO.JetEngine ' Compacts database Data.Mdb to Data2.mdb. je.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Dump\DataOld.Mdb", _ "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Dump\Data.Mdb"
8
3128
by: John Baker | last post by:
Hi: I am URGENTLY in need of some book or web site OR tool that will help me integrate a relatively simple access application into a web page or pages. This is a time recording system (by project), and I would be more than wiling to pull the updated database down from the Host using FTP on a monthly basis. Its just that I need to understand...
2
1703
by: TM | last post by:
I am trying to learn ASP.net and created an ASP.net application on my windows 2003 server on my home LAN, and was wondering the correct way to add an access database to this application ? Do I just copy it to the application folder, where do I put it ? Also, how can I allow my application to access this file correctly ? I know most...
3
1683
by: blantz | last post by:
I am trying to connect to an Access database on a network drive and the web server is on the same network, i.e. G:\sample\test.mdb and everytime I try to connect to it I get an error saying... 'G:\sample\test.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file...
7
2903
by: Allison | last post by:
Hi -- we are a small manufacturing looking for a multi-user database to take customer orders (nothing too complicated, with 3 users total). We think we should be using Access, but are wondering what alternatives there are. It has been recommended to us to use ASP.net and SQL instead, with the reasoning that: 1) Access is likely to go...
15
4578
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never...
9
3819
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. ...
2
1488
by: dismantle | last post by:
Hi all, I need code help to perform a search code using access database i tried to search other threads but only saw this thread http://www.thescripts.com/forum/thread580180.html and its very detailed but problem is its for sql server i fink
4
2128
by: Tony | last post by:
I am trying this: SQL = "INSERT INTO GradeList (Date) Values(#01-01-2007#)" I get message "Syntax error in Insert statement". How to add date field in access database?
2
1178
by: BalaC | last post by:
Hi, Some time ago a friend's friend showed me a sample project to access the tables in MS Access directly through vb code. I couldn't see any ADO control on any of the forms. The ActiveX Objects library was however included in the project references. I tried to do the same thing on my own with a trial project using the Northwind database, but...
0
7924
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. ...
0
8130
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...
1
7677
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...
0
7979
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...
0
6284
agi2029
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...
1
5514
isladogs
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...
0
5219
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...
0
3653
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...
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.