Paste text to form

  • Thread starter Thread starter Stephen sjw_ost
  • Start date Start date
S

Stephen sjw_ost

I have an interesting request that I am trying to figure out how to do. Let
me explain a little first.
I get lists of numbers sent to me for an exclusion process that I am having
to enter each number manualy into the main database for the exclusion to be
effective. I want to automate this process.

I have created a DB that can hold the numbers and I have created the code to
be able to produce the kind of file needed to automate the end of this whole
process.

What I am needing to find out how to do is; I want to be able to copy the
numbers sent to me into a form, click a cmd button and have the numbers input
into my table. When I try to do this using a text box, the entire text box is
treated as the string that it is and everything from the text box gets
updated to 1 field. I need each individual number from the text box to be
updated to its own field in the table.

Is there a way to do this? I hope I am making sense.
Any help or suggestions are greatly appreciated.
 
There are the Left, Mid and Right functions that can help with this.
If the string you paste always has the same number of characters, this makes
it easier.

Here is some code written in a way that is more straight forward to
understand than if I had written some complicated looping code.
To get the 1st character,
Left$(strTxt,1)
Where strTxt is the string you are copying into the database.
Me.[ControlName1] = Left$(strTxt,1)

To get the next character,
Me.[ControlName2] = Mid$(strTxt,1,1)

ControlName1 is the name of the textbox that will accept the 1st character.
It should be bound to the table field that the 1st character will go into.

ControlName2 is the name of the textbox that will accept the 2nd character


Search in vba help for Left, Mid and Right functions for examples.

Replace ControlName with your object names.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Back
Top