472,792 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,792 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

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 12464
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

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...
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...
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...
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......
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...
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...
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...
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...
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?
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...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.