run time error

T

Terrance Popos

When I attempt to import a text file (.txt) in to Access, an error occurs.

Run-time error ‘3163’:
The field is too small to accept the amount of data you attempted to add.
Try inserting or pasting less data
When I click the Debug button this pops up: .Fields("TranType").Value = rs
("MoveType").Value



A different error occurs when save it to my desktop, and this is what
happens.

Run-time error ‘2185’:
You can’t reference a property or method for a control unless the control
has the focus.
When I click the Debug button this pops up: MsgBox "Import File Not
Found:" & Chr(13) & txtImportFile.text, vbCritical, "File Not Found"
 
S

storrboy

When I attempt to import a text file (.txt) in to Access, an error occurs.

Run-time error '3163':
The field is too small to accept the amount of data you attempted to add.
Try inserting or pasting less data
When I click the Debug button this pops up: .Fields("TranType").Value = rs
("MoveType").Value

For this error the target field (I assume "TranType") has a size limit
that is smaller than the imported data. Depending on the datatype it
could mean the field limits to 5 characters and the import is ten, or
an integer field is told to accept a long value. Either change the
field type/size, or add error trapping to whatever this code is to
account for this fact and warn the user nicely.

A different error occurs when save it to my desktop, and this is what
happens.

Run-time error '2185':
You can't reference a property or method for a control unless the control
has the focus.
When I click the Debug button this pops up: MsgBox "Import File Not
Found:" & Chr(13) & txtImportFile.text, vbCritical, "File Not Found"

Try adding the appropriate form reference.

Me!txtImportFile.text
or
Forms("FormName")!txtImportFile.text
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top