Solved

Access 2013 - Sample DAO code

Posted on 2015-02-19
2
221 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 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now