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

ADOTable problem

Status
Not open for further replies.

MLNorton

Programmer
Nov 15, 2009
134
US
I have a ADOTable (Access database) that contains Fields with names of 1A, 1B, 1C, 2A, 2B. 2C ….. 51A, 51B, 51C, 52A, 52B, 52C. These fields will contain data for each week of the year. Wheh I try to access a field with FieldByName(‘1A’).As Currency Delphi cannot find the field.
What is the problem and what is the solution?
 
The data type is number, fixed, decimal places 2. The field is identifed as AsFloat not AsCurrency.
 
The version of Access I have has a currency type. (Office 2007 - Don't know how long it's been available, or if you have it in your version) You may want to see if selecting this data type within Access solves the problem.
 
Don't know how far you've gotten on your application, but there are better ways to organize your data. If you entering an A, B, C entry for each week of the year, you're still going to have problems incorporating multiple year's data in your design (unless there's more to the database that you didn't post).

You can take a look at this design, hope it helps. (I think it will also make querying the database much easier).

Table: year
Columns:
year_id: AutoNumber (Primary Key)
year_number: Text Length 4

Table: weekly_amount
Columns
year_id: Number (References Year_id in Table: Year) (Primary Key)
week_amount_id: AutoNumber (Primary Key)
week_number: Number (Primary Key) (rule: must be <= 52)
week_designator: Text Length 1 (Primary Key) (rule: must be within 'A', 'B', 'C')
week_amount: Currency
 
I have tried this using the currency type with the same result. I am using Access 2010 but the data is in the 2003-07 format.

I am recording weekly contribtions with fielde for Cash, Check and Check number.I will have a different Table for each year.
 
I guess you can fall back on using the field's display format to format it, rather than using the .AsCurrency, but don't know if that'll introduce rounding errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top