Help with correct Method/syntax

B

BillT

Hi:

I'm trying to create a form for user input and this is
what I need it to do:
1. User inputs dead battery# and trucktype. (C or R)
2. Form returns available battery.

There are also two types of batteries obviously that
correspond with the two types of trucks. C and R.
If Battery# entered = R, return oldest dated R battery or
if Battery# entered = C, return oldest date C battery.
eg. User enters Battery# 39a, TruckType R. Program
returns Battery#52b that is a R type. I have created
tables that separate batteries 1-52 that are R type and
batteries 53-85 that are C type.
Also, when a user inputs the dead battery, I need that
input to have a date stamp associated with it. How do you
do this.

So far, I have a query the returns the oldest date but I'm
not sure how to link everything together. Syntax help
whichever method is suggested would be greatly appreciated
also.

tblBatteryCycles tblBatteries tblTrucks tblTruckTypes
Battery# Battery# TruckID TruckType
DateRemoved TruckType TruckType TruckTypeName
RemovedFrom
HoursUsage
DateCharged
DateInstalled
InstalledIn

TIA
BillT
 
M

Marshall Barton

BillT said:
I'm trying to create a form for user input and this is
what I need it to do:
1. User inputs dead battery# and trucktype. (C or R)
2. Form returns available battery.

There are also two types of batteries obviously that
correspond with the two types of trucks. C and R.
If Battery# entered = R, return oldest dated R battery or
if Battery# entered = C, return oldest date C battery.
eg. User enters Battery# 39a, TruckType R. Program
returns Battery#52b that is a R type. I have created
tables that separate batteries 1-52 that are R type and
batteries 53-85 that are C type.
Also, when a user inputs the dead battery, I need that
input to have a date stamp associated with it. How do you
do this.

So far, I have a query the returns the oldest date but I'm
not sure how to link everything together. Syntax help
whichever method is suggested would be greatly appreciated
also.

tblBatteryCycles tblBatteries tblTrucks tblTruckTypes
Battery# Battery# TruckID TruckType
DateRemoved TruckType TruckType TruckTypeName
RemovedFrom
HoursUsage
DateCharged
DateInstalled
InstalledIn


You can get the data for the oldest one by using a query
like this:

SELECT Top1 [Batery#]
FROM the table
WHERE BatteryType = Forms!theform.TruckType
Order By DateRemoved
 
Top