3163 Field is too small

D

deb

I am getting error 3163 - Field is to small...
it error at ... rs!NewValue = rstemp!NewValue

I made the related tables changes to 255 char, but when the temp table is
created it is created with only 50 char on all fields. How can I make it
create with 255 char?

thanks


Sub WriteTempTableToAuditTable()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rstemp As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("AuditTable")
Set rstemp = db.OpenRecordset("rAuditTemp")

Do Until rstemp.EOF
rs.AddNew
rs!TableName = rstemp!TableName
rs!RecordPrimaryKey = rstemp!RecordPrimaryKey
rs!FieldName = rstemp!FieldName
'rs!LoginName = Environ("UserName") 'requires environment variable
'rs!MachineName = Environ("computername")
rs!LoginName = GetCurrentUserName
rs!MachineName = GetComputerName
rs!User = CurrentUser 'returns Access Security name
rs!OriginalValue = rstemp!OriginalValue
rs!NewValue = rstemp!NewValue
rs!DateTimeStamp = rstemp!DateTimeStamp

rs.Update
rstemp.MoveNext
Loop

rs.Close
rstemp.Close
db.Close

Call ClearTempTable
 
D

Douglas J. Steele

I'm not sure I understand what you're trying to accomplish. You're not
creating a new table anywhere there: AuditTable and rAuditTemp both exist
before your code runs.
 
T

Tony Toews [MVP]

deb said:
I made the related tables changes to 255 char, but when the temp table is
created it is created with only 50 char on all fields.

Did you create your temp table with only 50 characters or are you
creating it use DAO code?

If you are using DAO code then add another parameter.
CreateField("FieldName", dbText, 255)

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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

Similar Threads


Top