Help! A new Access programmer from FoxPro

  • Thread starter Christopher Panadol
  • Start date
C

Christopher Panadol

Hello all! I am a FoxPro programmer and now I should handle Access project. I think I
want to collapse to write Access code. Just like I am writing a login screen. If I wrote
it in FoxPro, I can use 5 minutes to complete it. However I do not know how to write in
Access. I hope that you can help me.

I have designed a table in Access (call User) with 2 fields, "Name" and "Password"
I have designed a form that have 2 text fields, txtName and txtPass to handle user's
input.

What I want to write is simple: After user click's "OK" button, I want to call User table
and search whether the name is existed. If yes, then check whether the password is
matched. If yes, the user can log-in to another form.

It makes me headache that how I can call table and search record so easy as what I did in
FoxPro? I know there is something like recordset but I do not know the concept....
 
R

Rick Brandt

Christopher Panadol said:
Hello all! I am a FoxPro programmer and now I should handle Access project. I think I
want to collapse to write Access code. Just like I am writing a login screen. If I wrote
it in FoxPro, I can use 5 minutes to complete it. However I do not know how to write in
Access. I hope that you can help me.

I have designed a table in Access (call User) with 2 fields, "Name" and "Password"
I have designed a form that have 2 text fields, txtName and txtPass to handle user's
input.

What I want to write is simple: After user click's "OK" button, I want to call User table
and search whether the name is existed. If yes, then check whether the password is
matched. If yes, the user can log-in to another form.

It makes me headache that how I can call table and search record so easy as what I did in
FoxPro? I know there is something like recordset but I do not know the
concept....

If DCount("*", "User", "[Name] = '" & Me!txtName & "' And [Password] = '" &
Me!txtPass & "'")>0 Then
'Name and Password are good
Else
'Name and Password are bad
End If

The DCount() function above looks at your table and returns the count of
records where the Name and Password match what is on your form. If it
returns zero then the combination doesn't exist.


Now for the warnings:

"Name" is a property of nearly every object built into Access and VBA and
as such should never be used as the name for any of your fields or objects.
It is too easy for your code to accidentally pull the property instead of
what you intended. I suggest you change to UserName or similar.

Any "home grown" security system like you're attempting will be trivially
easy to bypass for those who have any knowledge of Access at all. If
you're just trying to provide guidance to honest people, fine. Just don't
trust it for anything that really needs to be secure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top