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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lookup alphanumeric number to search if number already exist in table.

Status
Not open for further replies.

kat25

Technical User
Feb 26, 2003
105
US
I have a main form (RingArch)that has a command button on it to open another form,(Est.NewRing), On the Est.NewRing form the user can enter an alphanumberic value in the RingID field for a new ring number to be added. The users do not know if someone else has already entered this number into the table.
I would like for the user to input the new ring value into the text box (on the Est.NewRing form) and have code to verify if the ring number already exist. If so, msg stating "ring already exist", then closing the Est.NewRing form without adding the record to the table and return to the main form(Ring Arch).

I am very new to coding and would appreciate any help you can offer. Thank you.

Kat


 
I see the following example:
DLookup("[UnitPrice]", "Order Details", "OrderID = 10248")

In this example, you would be retrieving the UnitPrice field from the Order Details table where the OrderID is 10248.
*********************************************************
If the "orderid" could be a different number each time the user inputted the number, how would I code this so that the lookup would be on the inputted value?

Thanks again.
 
Using txtOrderID text box on a form to lookup numeric OrderID...

DLookup("[UnitPrice]", "Order Details", "OrderID = " & Me.txtOrderID.Value)

Using txtOrderID text box on a form to lookup alpha OrderID...

DLookup("[UnitPrice]", "Order Details", "OrderID = '" & Me.txtOrderID.Value & "'")
 
I will try this.

Thank you so much for your quick responses.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top