Searching for an autonumber (1 Viewer)

Gkirkup

Registered User.
Local time
Today, 05:27
Joined
Mar 6, 2007
Messages
628
I have a large inventory table where every item has a stock number, which is an autonumber.
I want to search for the item by stock number and have a number field where the stock number is entered, and that displays a subform with details of that stock item.
However it does not work! I get a data type mismatch! How do I search for an autonumber?

Robert
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 08:27
Joined
May 21, 2018
Messages
8,527
My psychic abilities are lacking. Any chance you can share some code or your database?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:27
Joined
Feb 28, 2001
Messages
27,167
Like MajP, I think I left my crystal ball in my other pants. What doesn't work? Finding the MAIN record where that number is used, or finding the records in the SUBFORM where the details are kept?
 

jdraw

Super Moderator
Staff member
Local time
Today, 08:27
Joined
Jan 23, 2006
Messages
15,378
As others have indicated - not much info to go on and hard to guess/divine what you are asking.

Here is an example from my test data where AnimlId is an autonumber.

Code:
SELECT AnimalCapture.CaptureDate, AnimalCapture.AnimalId
FROM AnimalCapture
WHERE (((AnimalCapture.AnimalId) Between 4 And 8));
 

Isaac

Lifelong Learner
Local time
Today, 05:27
Joined
Mar 14, 2017
Messages
8,777
Guessing it has something to do with your search code or query syntax and using quotes or not
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:27
Joined
Feb 19, 2002
Messages
43,257
I left my crystal ball in my other pants.
My pants don't have pockets. It's a male chauvinist plot to keep women downtrodden:)

Searching for an autonumber is the same as searching for any other field. As the others have mentioned, you have to be cognizant of the data types because strings need to be delimeted with single or double quotes, dates by the pound sign ##, and numeric data types are not delimited.
 

Users who are viewing this thread

Top Bottom