473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

VB6, code refer to access database

1 Bit
Hi, want to ask the following

if rs.fields(0).value=text1.text and rs.fields(1).value=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 13071
MerlinTheGreat
6 Nibble
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
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...
8
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...
2
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...
3
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......
7
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...
15
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...
9
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...
2
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...
4
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
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.