PC Review


Reply
Thread Tools Rate Thread

Adding parsed data to a table

 
 
=?Utf-8?B?RnJhbmsgQQ==?=
Guest
Posts: n/a
 
      28th Jan 2006
Overview:

I am using Access 2003 / VBA for the following problem.

I have two tables:

1. tblAttend
fields:
id - autonumber
attendees - memo {name: txtattendees}

2. tblNames
fields:
id - autonumber
name - text {name: txtname}
atten_fk - number

txtattendees and txtname are the names of the respective text boxes in the
corresponding forms. The main form is call 'frmAttend1' and the sub form is
called regretably, 'tblNames Subform'.

There is a one to many relationship:
from tblAttend.id <> tblNames.atten_fk

I have created a form where tblNames is a subform of tblAttend. The
attendees field has a list of names that have been pasted in. This data acts
as one long string where there are names in the format Last, First. Also
some of the data has blank lines and some of the line have a single word
entry that is not needed.

The approach I took was to parse the list in the attendees field and put
each name into an array. Then to take each element in the array and add it
to a record in the tblNames table.

The initial code is linked to a command button and is as follows:

Private Sub cmdAddRec_Click()

SplitString (txtattendees)

End Sub
-----------------------------------------------------------------------------
The next code to run is as follows:

Public Sub SplitString(sMyString As String)
Dim MyArray() As String
Dim ctr As Integer
Dim sItem As Variant

MyArray = Split(sMyString, "")

For Each sItem In MyArray
DoCmd.GoToRecord , , acNewRec
[tblNames SubForm]!txtname.SetFocus
[tblNames SubForm]!txtname = sItem
Next
End Sub

But when I run it I get an error:

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.


Any ideas?

Thank you


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsed Data has space =?Utf-8?B?a2F5YWJvYg==?= Microsoft Access 3 31st Jan 2007 11:56 PM
Reporting on data parsed from text (notes) field =?Utf-8?B?REJH?= Microsoft Access Reports 2 7th Nov 2005 06:40 PM
Browsing webpage on A2000 form and importing parsed data Silvester Microsoft Access Forms 0 3rd Feb 2005 09:38 PM
Browsing webpage on A2000 form and importing parsed data Silvester Microsoft Access Form Coding 0 3rd Feb 2005 09:38 PM
Adding data to the data table without adding a data marker to the chart BA Microsoft Excel Charting 2 19th Nov 2003 09:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:12 AM.