Solved Data Entry Error (1 Viewer)

Emma35

Registered User.
Local time
Today, 14:50
Joined
Sep 18, 2012
Messages
497
Hi All,
I've got a database for entering maintenance information about various machinery. On the data entry form, i have a combo box which has several columns and i've used some code in the OnChange event of the combo box to populate other text boxes on the form when i make a selection to save time. Most of these text boxes populate fine except for one which keeps giving me the error attached. (Column 4)
The field for the one giving problems is set to 'Number' in the table and the info i'm trying to enter is a 12 digit number with no decimal places. I've tried changing the table field to Short Text but it still won't accept this 12 digit number. Anyone any idea why this is happening. The OnChange code is below

Code:
Private Sub cboMachine_Change()
Me.Desc = Me.cboMachine.Column(2)
Me.SKU = Me.cboMachine.Column(3)
Me.INumber = Me.cboMachine.Column(4)
Me.Cost = Me.cboMachine.Column(5)
Me.BioInfo = Me.cboMachine.Column(6)
End Sub
 

Attachments

  • Error.PNG
    Error.PNG
    3.9 KB · Views: 175
first use the afterupdate event of the combo.

if the table field is numeric, try specifically changing the datatype to a long.

Code:
Me.INumber = Clng(Me.cboMachine.Column(4))
 
change the field to Double or Currency or Decimal.
Long integer can only accommodate 8 digit number (not 12)
 
Thanks lads. I changed the table field to Double and reset the code into the AfterUpdate event and all's well again.
Appreciate the help as always
Em x
 
That's not strictly correct, I think. A long can go to just over +/- 2 billion, so certainly any number up to 1 billion, hence 9 zeroes, but not a 12 figure number anyway.

A longlong in 64bit Access could manage a 12 bit integer.

As your serial numbers are more in the nature of text values, you could have just stored the12 digit "number" as text. Unless you need to do arithmetic operations on them, which is unlikely, text would work OK, and then you could also show leading zeroes if necessary. (like a telephone "number")
 

Users who are viewing this thread

Back
Top Bottom