MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
November
Sun Mon Tue Wed Thu Fri Sat
         
23
24 25 26 27 28 29 30
2024
Months
NovDec


Sun, Oct 18, 2015 9:00 pm

Stop Access from rounding number

For a field in an Access 2013 database that I wanted to hold the amperage for a device's power adapter, e.g., 1.5, I specified the field should be a number with a "fixed" format. But whenever I put in 1.5, Access would change it to 2. I clicked on the button to increase the number of decimal points, but Access would round the number 1.5 to 2.0 then. To resolve the problem, I clicked on View for the table and selected Design View.

Access design view

I could then see, when I selected the field that was to hold the amperage, that the Field Size value was set to Long Integer. An integer field, obviously, won't hold a fractional part for the number.

Access Long Integer field size

I set the value to Single instead by clicking in the field and selecting that option from the dropdown list, so I could store a floating point value in the field rather than an integer.

Access Single field size

From the dropdown list for field size, you can select the following values:

Setting

Description

Decimal precision

Storage size

Byte

Stores numbers from 0 to 255 (no fractions).

None

1 byte

Decimal

Stores numbers from -10^38-1 through 10^38-1 (.adp)
Stores numbers from -10^28-1 through 10^28-1 (.mdb, .accdb)

28

2 bytes

Integer

Stores numbers from -32,768 to 32,767 (no fractions).

None

2 bytes

Long Integer

(Default) Stores numbers from -2,147,483,648 to 2,147,483,647 (no fractions).

None

4 bytes

Single

Stores numbers from
-3.402823E38 to -1.401298E&45
for negative values and from
1.401298E-45 to 3.402823E38 for positive values.

7

4 bytes

Double

Stores numbers from
-1.79769313486231E308 to -4.94065645841247E-324
for negative values and from
4.94065645841247E-324 to 1.79769313486231E308 for positive values.

15

8 bytes

Replication ID

Globally unique identifier (GUID)

N/A

16 bytes

Note: you can see the values that each one can hold by hitting the F1 key to get online help on the topic after clicking on the value stored in the Field Size field while in Design View.

When I switched back to Datasheet View by clicking on View and then selecting Datasheet View, I was then able to change the value from 2.0 to 1.5 and have it remain as 1.5, i.e., Access had stopped rounding numbers to the nearest integer for the field.

References:

  1. Field Size Property

[/software/database/access] permanent link

Sat, May 05, 2007 10:30 pm

Opening One Form in Access from a Field in Another Form

I had two tables in a database, one called "HDD", which holds information on hard disk drives, such as serial number, model number, capapcity, etc. I had another table I called "External", which I use to keep track of information regarding external disk drive enclosures I use for backing up systems. That External database also has a "Drive SN" field that has the serial number for the hard disk drive within the enclosure. I created forms with matching names for each table, i.e. an "HDD" and "External" form.

I wanted to be able to double-click on the drive serial number in the "External" form and have the "HDD" form open with the record displayed with the corresponding serial number, so that I could view all of the information on the particular hard disk drive within the drive enclosure that I had selected in the "External" form. I used the following procedure to be able to do so.

  1. In the drive serial number field of the "external" form, I right-clicked and chose Properties.
  2. Scrolled down to the "On Dbl Click" field.
  3. I clicked on the button with "..." on it.
  4. I chose Macro Builder and clicked on OK.
  5. I gave it a name of OpenHDD and clicked on OK.
  6. For Action, I chose OpenForm.
  7. In the Form Name field, I put in HDD, the name of the form that displays information on the hard disk drives.
  8. For View, I selected Form.
  9. For Where Condition, I clicked on the "..." button and chose Tables then the HDD table beneath it.
  10. I then selected Serial Number in the next column and double-clicked on <Value> in the last column, which gave me [HDD]![Serial Number] in the Expression Builder field.
  11. I then clicked on the equal button to add = at the end of the expression and then added Forms![External]![Serial Number] giving me [HDD]![Serial Number] = Forms![External]![Drive SN] .
  12. I then clicked on OK
  13. For the Comment field, which is to the right of the Action field, I put "Open HDD form to drive corresponding to External drive SN"
  14. I then closed the Expression Builder window, saving the macro.
  15. I then closed the Properties window that was open for the Drive SN field.

I was then able to click on the drive serial number field in the External form and have the HDD form open displaying the information on the hard disk drive within the enclosure.

[/software/database/access] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo