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

Checking for Previous Table Entries on a Front-End Form? 1

Status
Not open for further replies.

fbueller

Programmer
Sep 6, 2006
9
US
I am relatively new to ADPs and Access development. I am creating an appl to track industrial shipments. When a truck comes onsite, 2 weights are recorded..an Incoming(full) weight and an Outgoing(empty) weight.

I have a table named SCALE_READINGS to store Incoming/ Outgoing weights for each truck. 1 truck ends up 2 weight entries to form a complete record.

I have not been able to figure out a way to run a query behind the scenes to check the SCALE_READINGS table when a user selects the record button to insert a new entry. I have written a stored procedure accepting the TruckId and WeightType(In/Out) parameters chosen on a form which featurs a SELECT COUNT statement to determine if there is a previous entry of that weight type for a truck. A value of '1' means YES.

But I am not sure how to tie this query which works great when run manually to a hidden control on the main form. I have been experimenting with the different DoCmd options(RunSQL, OpenStoredProcedure, OpenQuery) to no avail.

Can someone give me any pointers? If the returned count is 1, I want to present the user with a MsgBox making sure they want to overwrite the previous record.

Any help would be appreciated!
 
Have you tried the DCount function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The DCount fn() was exactly what I was looking for!! It took me a little while to figure out how to set the criteria according to form parameters, but I got it.

I have been working from what I thought was a great book: MS Office Access 2003 Inside and Out from MS Press. It’s one of those huge monster books with over 1200 pages. I thought it was good, but when I went back and looked there was no mention of the DCount fn().

Is there a website or book that you would recommend to find a complete, indexed view of available procedures and fn() available?
 
I've personally only played with the F2 and F1 keys in VBE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top