Need to display an error message when a duplicate object is clicked.

G

GBPackerBacker

Hi all, I'm new to Access and I'm creating a simple IT Inventory
database. My first form just has details on the device, and I want to
be able to have the users select an IP address from a dropdown list.
I have the list and the dropdown working flawlessly, but in my table I
selected No Duplicates, so that no one IP address can be used twice.

What I'd like to do, is that if the DB detects a duplicate, to pop up
a dialog box stating that the IP address is already in use and to
please select a valid IP address. By default, there is an error that
pops up when you try to save the record, but it is so generalized that
you have no idea which one of the 15 different fields may have the
problem.

My thought is to do this in VB, but I'm not aware of how to call a vb
dialog box from Access.

Any help would be VERY much appreciated!!
 
B

Boyd Trimmell

I would use the before update event of the combo box to select an IP address.
YOu can use a DLOOKUP to see if there is another record witht he same IP
Addess.

Something like:

If DLookUp("[CustomerID]","[Customers]","[CustomerID] = Me.[CustomerID] ") >
"" then
Msbgox "The Customer ID you entered already exists. Enter a unique ID."
Cancel = True
End if

You said:

"in my table I selected No Duplicates, so that no one IP address can be used
twice"

What if the equipment is marked as inactive/out of service and you add the
same IP to a new piece of equipment? To maintain the history, you will have
to have duplicate IP's

Hope this helps ...

Boyd Trimmell aka HiTech Coach

url:http://www.ureader.com/msg/105317257.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top