Why My Database Crashes :(

J

John

I have a very simple table (Test) with a single
field (Col1) in it. I am trying to insert into it a value
from a text-box (txtBox) on a form (Test_Form). I have a
macro which activates the query that I wrote myself in SQL
View:
INSERT INTO Test
VALUES ([Forms]![Test_Form]![txtBox]);

Problem: If I enter up to 127 characters in the textbox
the Insert works fine. However 128 and more characters do
not get inserted and the whole database hangs completelly.
ANYTHING I try to do after that displays that message "
You can't carry out this action at the present time!", so
that I have to kill the database each time.
I tested it many times, the 128th character does it!
It's not the size limitation of the Col1 field in the
table because I tried declaring it as "Memo" datatype or
as "Text" with 255 size limit.
Please help me out!
 
A

Adrian Jansen

Just tried it in Win2000, Access 2002, and it works ok for me. Only
difference is that I wrote the macro as code in VBA and called it from a
command button.

Private Sub Command2_Click()
Dim mySQL As String

On Error GoTo Err_Command2_Click


mySQL = "INSERT INTO tblTest VALUES ([Forms]![frmTest]![f2]);"
DoCmd.RunSQL mySQL


Exit_Command2_Click:
Exit Sub

Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click

End Sub


You realise of course that you can just bind the form to the table (
preferably via a query ) as a data source, then anything you enter in the
textbox will automatically be saved to a field in the table as you move from
record to record ?
Saves lots of code and macros to let Access do the work for you.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 

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