![]() |
Compare a value from record set to prevent duplicate recordset in DB
I’m creating a small database to store some peer review records.
I created two tables
My recordset is searching the practitioner table’s IDNum field to see if it matches the value in the IDNum text box. I setup a Msgbox to see what’s being matched “MsgBox strIDNumber + Me.IDnum.Value” Msgbox results: 3636 2424 For some reason the only value that’s being matched is the first record in the IDNum field which is 3636 and it’s not moving on from there. So if I put in 2424 into the IDNum text box the code thinks that there is no 2424 in the database and creates the new record. Code:
' Displays a message box with the yes and no options. |
When you fill a recordset object it defaults to the first record. You can fill the object from a SQL statement limiting it to only the one record where Me.IDnum.Value occurs or an empty record set if it can't be found. The rstPractitioner object has a "RecordCount" property: test for > 0. It also has a filter property if you need to test for several values one at a time and there are the EOF and BOF properties will will both be true for an empty recordset.
|
All times are GMT -6. The time now is 08:10 PM. |
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by
DragonByte SEO v2.0.15 (Lite) -
vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.