Solved

Access 2013 - Sample DAO code

Posted on 2015-02-19
2
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Starting up a Project
Suggested Courses

617 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