auto check

  • Thread starter Thread starter Angeliqur
  • Start date Start date
A

Angeliqur

Hello all

i have a table whit a field callt "orderparts"
if i want to fil in a new record i need this fiels to be checkt on dubbel
entry. So that i do not fil in twice the same parts.
How can i do this. I am thinking on a after update event.
please help i am stuck here.

thanks
 
In design mode, for your tbl, at the relevant field -unique index, you can
add a msg.
This however will apply to this field throughout the tble so maybe not
neccessarily what you want
Perhaps therefore you might want to explain more fully, eg what you are
trying to do/achieve
 
Hello all

i have a table whit a field callt "orderparts"
if i want to fil in a new record i need this fiels to be checkt on dubbel
entry. So that i do not fil in twice the same parts.
How can i do this. I am thinking on a after update event.
please help i am stuck here.

thanks

Use the BeforeUpdate event of the control on the Form.

If the [OrderParts] field is a Number datatype:
If DCount("*","TableName","[OrderParts] = " & Me([ControlOnForm]) > 0
Then
MsgBox "This part exists in the table."
Cancel = True
End If

If [OrderParts] is Text datatype:
If DCount("*","TableName","[OrderParts] = '" & Me![ControlOnForm] &
"'") > 0 Then
 
Unless I am mistaken, I saw this identical post, but without this newsgroup
in the header, in a different newsgroup. That is called "multiposting", and
is strongly discouraged. Instead, if you feel you must post to multiple
newsgroups, "crosspost", that is, put all the newsgroup names in the message
header. Answers will then default to going to each newsgroup, making life
easier both for you and for the people answering the question.

For other good suggestions on effective use of newsgroups, see the FAQ at
http://www.mvps.org/access/netiquette.htm, the "official Frequently Asked
Questions site for the USENET newsgroup comp.databases.ms-access".

Larry Linson
Microsoft Access MVP
 
Back
Top