Solved

Access 2013 - Sample DAO code

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 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

16 Experts available now in Live!

Get 1:1 Help Now