Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access 2013 - Sample DAO code

Posted on 2015-02-19
2
Medium Priority
?
238 Views
Last Modified: 2015-02-22
My OS is win 7 prof 64 bit and i use Access 2013.  i have a small password creating App which works fine without problems.  I now want now to check the created password with those that have been created before, and if a duplicate exists, then to re-generate the password code again, if not, then to append the password to a field in the table.
The name of the table, is tblMainpassword.  The name of field where the old passwords are : strcreatedpwds; and the name of the variable holding the newly created password is : strgeneratedpwd.

Hope the Experts can give me the sample syntax on how to go thru the field in he table one by one to check if it exists or not.  
Thank u.
0
Comment
Question by:jegajothy
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 40618952
If DCount("*", "tblMainPassword", "strCreatedpwds='" & strgeneratedpwd & "'") > 0 Then
  MsgBox strgeneratedpwd " & already exists"
Else
  CurrentProject.Connection.Execute "INSERT INTO tblMainPassword(strCreatedPwds) VALUES('" &strGeneratedPwd & "'")
End If
0
 

Author Closing Comment

by:jegajothy
ID: 40624727
thank u.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Introduction to Processes
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question