Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating if content of textbox is Unique

Status
Not open for further replies.

caman74

IS-IT--Management
Jan 1, 2005
67
NO
Hi.

I have a textbox "txtNumber" that contains either two or eight characters (numbers).
I also have a textbox called "txtDep".
Both textboxes are placed in the form "frmTrspInv".

What I need is when I input a eight character number, to have a popup box let me know if there are any identical numbers.
I only need the popup box to show if there are any identical numbers.
I also need the choise to either input the number or not.

I.E if I in the txtbox "txtNumber" input the number 77018854 the popup will let me know if that exact number has been used before.

Christian
 
How about using DLookup?

Code:
Private Sub txtNumber_Change()
    If Not IsNull(DLookup("numberFieldName", "tableName", "numberfieldname = " & txtNumber.Text)) Then
        MsgBox ("found")
    End If
End Sub

-Pete
 
You will need to add brackets to the fieldname:
"[numberFieldName]"

The Microsoft mascot is a butterfly.
A butterfly is a bug.
Think about it....
 
Right-o. Tried it here & worked fine. Must be a carryover from my mis-spent youth (started with Access 97). Thanks for the update!

The Microsoft mascot is a butterfly.
A butterfly is a bug.
Think about it....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top