hi
I am very very new to working in access and need some help. I have a table where a specific data is stored and i have a form where i added a text box. I want to check if the data entered in the text box is the same as the one in the table. Is there a specific code i need to use. Sorry if this seems pretty silly, but ive just started working.
Thanks
6 1401
hi
I am very very new to working in access and need some help. I have a table where a specific data is stored and i have a form where i added a text box. I want to check if the data entered in the text box is the same as the one in the table. Is there a specific code i need to use. Sorry if this seems pretty silly, but ive just started working.
Thanks
On the OnExit event of the textbox, you could use "DLookup" to find the record in the table. Example: -
Dim data
-
-
data = dlookup("[Field Name]","YourTableName", "[Field Name] = Textbox")
-
-
If isnull(data) = true or data = "" then
-
'do something here
-
Else
-
Docmd.cancelevent
-
End If
-
Hope this Helps,
Bender
On the OnExit event of the textbox, you could use "DLookup" to find the record in the table. Example: -
Dim data
-
-
data = dlookup("[Field Name]","YourTableName", "[Field Name] = Textbox")
-
-
If isnull(data) = true or data = "" then
-
'do something here
-
Else
-
Docmd.cancelevent
-
End If
-
Hope this Helps,
Bender
Just let me know if the code i have written is right....
"New_password" is the field name
"Password" is the table name
"PswdTBox" is the name of the text box - If Data = DLookup("New_Password", "Password", "New_Password = PswdTBox") Then
-
DoCmd.OpenForm "Homepage", acNormal, , , acFormEdit, acWindowNormal
-
DoCmd.Close acForm, Me.Name
-
Else
-
MsgBox "Wrong Password! Sorry."
-
End If
Thanks
Just let me know if the code i have written is right....
"New_password" is the field name
"Password" is the table name
"PswdTBox" is the name of the text box If Data = DLookup("New_Password", "Password", "New_Password = PswdTBox") Then
DoCmd.OpenForm "Homepage", acNormal, , , acFormEdit, acWindowNormal
DoCmd.Close acForm, Me.Name
Else
MsgBox "Wrong Password! Sorry."
End If
Thanks
Try: -
Dim data 'This has to stay.
-
data = DLookup("[New_Password]", "Password", "[New_Password] = PswdTBox")
-
-
if isnull(data) = true or data = "" then
-
DoCmd.OpenForm "Homepage", acNormal, , , acFormEdit, acWindowNormal
-
DoCmd.Close acForm, Me.Name
-
else
-
MsgBox "Wrong Password! Sorry."
-
End If
-
Bender
Try: -
Dim data 'This has to stay.
-
data = DLookup("[New_Password]", "Password", "[New_Password] = PswdTBox")
-
-
if isnull(data) = true or data = "" then
-
DoCmd.OpenForm "Homepage", acNormal, , , acFormEdit, acWindowNormal
-
DoCmd.Close acForm, Me.Name
-
else
-
MsgBox "Wrong Password! Sorry."
-
End If
-
Bender
Well it doesnt work ..... it directly jumps to the else command.... is there something that i have to change in the table. The table has only the new password.... no other data is there in the table.... i'm pretty stumped...
Try: -
Dim data 'This has to stay.
-
data = DLookup("[New_Password]", "Password", "[New_Password] = PswdTBox")
-
-
if isnull(data) = true or data = "" then
-
DoCmd.OpenForm "Homepage", acNormal, , , acFormEdit, acWindowNormal
-
DoCmd.Close acForm, Me.Name
-
else
-
MsgBox "Wrong Password! Sorry."
-
End If
-
Bender
Hey this actually works..... if i change the code to
"If IsNull(data) = False Or data = "" Then"
Thanks a lot dude... probably couldnt have done this without ur help...
NeoPa 32,556
Expert Mod 16PB
Try : - If IsNull(DLookup("[New_Password]", _
-
"[Password]", _
-
"[New_Password]='" & Me.PswdTBox & "'")) Then
-
MsgBox "Wrong Password! Sorry."
-
Else
-
DoCmd.OpenForm "Homepage", acNormal, , , acFormEdit, acWindowNormal
-
DoCmd.Close acForm, Me.Name
-
End If
Make sure when you're testing that you check it handles both successful AND unsuccessful password entry.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mike |
last post by:
Hello,
After trying to validate this page for a couple of days now I was
wondering if someone might be able to help me out. Below is a list of
snippets where I am having the errors.
1. Line 334,...
|
by: John Flynn |
last post by:
hi all
i'm going to be quick i have an assignment due which i have no idea how to
do. i work full time so i dont have the time to learn it and its due date
has crept up on me ..
As follows:...
|
by: xunling |
last post by:
i have a question about answering ..... this topic is "need help"
what do i have to write at te topic line, !after i have klicked the
"answer message" button
ive tried many possibilities,...
|
by: sk |
last post by:
I have an applicaton in which I collect data for different parameters
for a set of devices. The data are entered into a single table, each
set of name, value pairs time-stamped and associated with...
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
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: pamelafluente |
last post by:
I am still working with no success on that client/server
problem. I need your help. I will submit simplified versions
of my problem so we can see clearly what is going on.
My model:
A client...
|
by: skumar434 |
last post by:
i need to store the data from a data base in to structure
.............the problem is like this ....suppose there is a data base
which stores the sequence no and item type etc ...but i need only...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need ...
|
by: mike |
last post by:
I help manage a large web site, one that has over
600 html pages... It's a reference site for ham radio
folks and as an example, one page indexes over
1.8 gb of on-line PDF documents.
The site...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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: 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...
| |