Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy from access to another program 3

Status
Not open for further replies.

haerion

IS-IT--Management
Sep 13, 2006
130
US
Hi all,

I was wondering if this was possible to control another program from an access form. More exactly, it would be like this:

Copy textbox1 from access
Go into the other program
Paste the textbox1
do enter 3 time (to go to another field in the program)
copy textbox2 from access
Go into the other program
Paste the textbox2
hit Enter 1 time
etc...until I have paste all of my textbox (approximately 10 textbox)

Is there a way to do something like this in vba?

Thank you all
 
There are a couple of ways, yes. However, it gets sketchy, at least if you use the SendKeys command. That's one option.

Another option is just finding some modules out there that deal with the clipboard.

Use that along with the Shell Object to select another application, and switch back and forth, and so on.

It can be done, but it can be tricky, bug-ridden, etc.

I setup a database at my church to send audio file information from an the Access database to an MP3 Recording program to fill in the details. It worked 100% great on the old computer we had at the time. Well, we later got a new machine with P4D processor and all that (was really new at the time), and ever since, the program works probably 1 out of 10 times!! That is the SendKeys part of the thing. It's almost like something else is grabbing the attention away from the MP3 program, no mater how I "grab" it! Oh the headaches. :0)

But it works all the same, just is a pain sometimes. So, it's still all good. [wink]

--

"If to err is human, then I must be some kind of human!" -Me
 
What other program are you trying to copy information into?
 
It is an old program using NIterm (terminal emulator for winsock) that we use for our sell data. I will try what kjv submitted me and see if this work :)
 
You can use API to control the Clipboard and information passed throught it.
 
Would you happen to have an exemple of the code?

The program name is "Versys:1 - NITerm"
 
I need to specify that the program is already open, I just need a code that would make it switch between program, is there such a code in vba?
 
Have a look at the AppActivate function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thread711-946898 will give you an idea of what you can do.
 
Hi all,

Thanks a lot for all your answer, I think i found out what is working best, thanks to PHV :)

Here is the code I'm using :

Code:
Private Sub cmdMakeOrder_Click()
Dim clerk As String
Dim acronym As String
Dim PO As String
Dim CustName As String
Dim addr1 As String
Dim addr2 As String
Dim addr3 As String
Dim postal As String
Dim ShipVia As String
Dim OnHold As String

acronym = Me.lboAcronym.Column(0)
clerk = Me.txtClerk
PO = Me.txtPO
CustName = Me.txtCustName
addr1 = Me.txtAddr1
addr2 = Me.txtAddr2
addr3 = Me.txtAddr3
postal = Me.txtPostal
ShipVia = Me.lboShipVia.Column(1)

AppActivate ("Versys:1 - NITerm")
SendKeys "{ENTER}"
SendKeys clerk
SendKeys "{ENTER}"
SendKeys acronym
SendKeys "{ENTER 4}"
SendKeys PO
SendKeys "{ENTER 4}"
SendKeys "+(N)" & "{ENTER}"
SendKeys CustName & "{ENTER}"
SendKeys addr1 & "{ENTER}"
SendKeys addr2 & "{ENTER}"
SendKeys addr3 & "{ENTER}"
SendKeys postal & "{ENTER}"
SendKeys ShipVia & "{ENTER 7}"

With this I can enter all the information in my other program. Thanks KJV and PHV for your help :) And thanks to Bubba too, even if I don't need to go by API, I'm sure this would have also work great :)

And one last question for you all, my last challenge is that I got a subform in a table view in which I enter all the item the customer wanna order. So if there is 6 line, I need to repeat the process for 6 lines, then go with another set of sendkey.

Is there a way to make a loop that would be the number of line in the subform? And how do I take the info for each line and write them back using a sendkey?

I will take any info you guys got :)
 
Too easy,

{Although I cannot condone the use of the Sendkeys!}, create a recordset of your subform and loop through it executing your dodgy code above each time. Something like: (pseudo code of course)

Code:
set rs=subform.recordsetclone
if rs.bof and rs.eof then 'no recs
    msgbox("no entries")
else
    rs.movefirst
    do until rs.eof
          {Your dodgy code}
          rs.movenext
    loop
end if

is that what you meant?
 
Thanks JBin, it work like a charm now, have a good day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top