?
Solved

Evaluate before update

Posted on 2011-10-19
2
Medium Priority
?
310 Views
Last Modified: 2012-05-12
Experts,
In my form frmDesignatedEmployee I have a combo box, data type number, named StoreID from my table tblStore.
I am needing to create new records in my table tblDesignatedEmployee. This table has a field data type number named StoreID. I would like to evaluate BeforeUpdate my combo box to check to make sure that StoreID in my tblDesignatedEmployee has not been already assigned the same StoreID from the Store table. Then inform the user that this store has a designated employee already.
Why? I use an Insert Into query because I need to write four records concurrently.
0
Comment
Question by:Frank Freese
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 36996235


place this codes before inserting the records
 
If dcount("*","tblDesignatedEmployee","[StoreID]= " & me.StoreID) >0 then
   msgbox "Store ID already exists"
 
   exit sub
end if

 
you can place the codes in the beforeupdate event of the combo box

If dcount("*","tblDesignatedEmployee","[StoreID]= " & me.StoreID) >0 then
   msgbox "Store ID already exists"
   cancel=true
   exit sub
end if
0
 

Author Closing Comment

by:Frank Freese
ID: 36996256
thank you - - - perfect
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

807 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