Hi There,
I am getting a run-time error 3800
'username' is not an index in this table. I'm not sure why I am getting
this.
Would really appreciate some help with it.. the code follows below..
Private Sub cmdOK_Click()
Dim strMsg As String
Dim varTNum As String, varPW As String
Dim varSec As Byte
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb()
Set rec = db.OpenRecordset("AdmUser")
strMsg = "User ID is incorrect or could not be found. Try again"
strMsg = strMsg & Chr(13) & "If this persists, contact the
Administrator."
If IsNull(Me!txtTNum.Value) Then
MsgBox "The T Number field cannot be blank", vbExclamation, "T
Number required"
Me!txtTNum.SetFocus
Exit Sub
Else
varTNum = Me!txtTNum.Value
End If
If IsNull(Me!txtPassword.Value) Then
MsgBox "The Password field cannot be blank", vbExclamation,
"Password required"
Me!txtTNum.SetFocus
Exit Sub
Else
varPW = Me!txtPassword.Value
End If
rec.Index = "TNum"
rec.Seek "=", varTNum
If rec.NoMatch Then
MsgBox strMsg, vbInformation, "Incorrect User ID"
txtTNum.SetFocus
Exit Sub
End If
If varPW <> rec(1) Then
MsgBox "Please retype your password. If this problem persists,
contact the Administrator.", vbExclamation, "Incorrect Password"
txtPassword.SetFocus
Exit Sub
Else
varSec = rec(2)
Select Case varSec
Case 1
DoCmd.OpenForm "frmPTForm"
Case 2
DoCmd.OpenForm "frmActivePTList"
Case 3
DoCmd.OpenForm "frmActivePTListPallCare"
Case 4
DoCmd.OpenForm "frmAdm"
Case Else
MsgBox "You do not have security to access these files. Please
contact the Administrator.", vbExclamation, "Access Denied"
End Select
End If
rec.Close
Set db = Nothing
Me.Visible = False
'DoCmd.Close acForm, "frmSignOn"
End Sub
--
thanks!!
smriti 1 1525
Smriti Dev wrote: Hi There, I am getting a run-time error 3800 'username' is not an index in this table. I'm not sure why I am getting this. Would really appreciate some help with it.. the code follows below..
Private Sub cmdOK_Click() Dim strMsg As String Dim varTNum As String, varPW As String Dim varSec As Byte Dim db As Database Dim rec As Recordset
Set db = CurrentDb() Set rec = db.OpenRecordset("AdmUser")
strMsg = "User ID is incorrect or could not be found. Try again" strMsg = strMsg & Chr(13) & "If this persists, contact the Administrator."
If IsNull(Me!txtTNum.Value) Then MsgBox "The T Number field cannot be blank", vbExclamation, "T Number required" Me!txtTNum.SetFocus Exit Sub Else varTNum = Me!txtTNum.Value End If If IsNull(Me!txtPassword.Value) Then MsgBox "The Password field cannot be blank", vbExclamation, "Password required" Me!txtTNum.SetFocus Exit Sub Else varPW = Me!txtPassword.Value End If
rec.Index = "TNum" rec.Seek "=", varTNum
If rec.NoMatch Then MsgBox strMsg, vbInformation, "Incorrect User ID" txtTNum.SetFocus Exit Sub End If
If varPW <> rec(1) Then MsgBox "Please retype your password. If this problem persists, contact the Administrator.", vbExclamation, "Incorrect Password" txtPassword.SetFocus Exit Sub Else varSec = rec(2) Select Case varSec Case 1 DoCmd.OpenForm "frmPTForm" Case 2 DoCmd.OpenForm "frmActivePTList" Case 3 DoCmd.OpenForm "frmActivePTListPallCare" Case 4 DoCmd.OpenForm "frmAdm" Case Else MsgBox "You do not have security to access these files. Please contact the Administrator.", vbExclamation, "Access Denied" End Select End If
rec.Close Set db = Nothing
Me.Visible = False 'DoCmd.Close acForm, "frmSignOn"
End Sub
-- thanks!! smriti
Are you certain that "TNum" is the name of the index? If you simply set
the TNum field to be the primary key then the Index name would be
"PrimaryKey", this is a common gotcha. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: leroybt.rm |
last post by:
Can someone tell me how to run a script from a interactive shell
I type the following:
>>>python filename
>>>python filename.py
>>>run filename
>>>run filename.py
>>>/run filename
>>>/run...
|
by: Ed |
last post by:
Hello,
I took a course in asp about 2 years ago and I was
practicing with IIS 5.0. Then I put it down for a while.
Now trying to get back to it. I can't run asp files from
subdirectories of...
|
by: orekin |
last post by:
Hi There
I have been trying to come to grips with Application.Run(),
Application.Exit() and the Message Pump and I would really appreciate
some feedback on the following questions .. There are...
|
by: Bob Day |
last post by:
Using vs2003, vb.net
I start a thread, giving it a name before start. Code snippet:
'give each thread a unique name (for later identification)
Trunk_Thread.Name = "Trunk_0_Thread"
' allow...
|
by: Bryan |
last post by:
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight...
|
by: Brett Wesoloski |
last post by:
I am new to VS2005.
I changed my program.cs file to be a different form I am working on. But
when I go to run the application it still brings up the form that was
originally declared as new. ...
|
by: Lee Crabtree |
last post by:
I remember when I was first getting into .NET Forms programming that
there was a rather emphatic rule about not constructing a form before
calling Application.Run with it. So this:
...
|
by: David Thielen |
last post by:
Hi;
In our setup program how do I determine if I need to run "aspnet_regiis –i"
and if so, is there an API I can calll rather than finding that program on
the user's disk and calling it?
--...
|
by: traceable1 |
last post by:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!
|
by: mxdevit |
last post by:
Task: run application from ASP.NET
for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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: 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...
| |