473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Help. Button: copy value from field, followed by start ext. application.

I want to add a button doing the following:

copying the value of a certain field (postal code)the present record
and then start an external application. How to perform the first?

Bart

Nov 13 '05 #1
9 3830
AA Arens wrote:
I want to add a button doing the following:

copying the value of a certain field (postal code)the present record
and then start an external application. How to perform the first?

Bart

Copying to what? To a variable?

Drag a command button to a form. Click on Events for the property sheet
of the button and in the OnClick event click the tripple button and
select Code. Now enter
Dim varCopyValue As Variant
Dim strAppToOpen
'copy value?
varCopyValue = Me.PostalCode
'open external app
strAppToOpen = "C:\Test\Test.Exe"
Shell strAppToOpen

Check out Shell for determining how the window of the app should display.

Nov 13 '05 #2
AA Arens wrote:
I want to add a button doing the following:

copying the value of a certain field (postal code)the present record
and then start an external application. How to perform the first?

Bart

Copying to what? To a variable?

Drag a command button to a form. Click on Events for the property sheet
of the button and in the OnClick event click the tripple button and
select Code. Now enter
Dim varCopyValue As Variant
Dim strAppToOpen
'copy value?
varCopyValue = Me.PostalCode
'open external app
strAppToOpen = "C:\Test\Test.Exe"
Shell strAppToOpen

Check out Shell for determining how the window of the app should display.

Nov 13 '05 #3
I want Access copies the contents of the field "postal code" (like
12345) which is part of the same form as the button i want to make, to
launch an external applicaiton. I need the copied value in the external
application.

Bart

Nov 13 '05 #4
I want Access copies the contents of the field "postal code" (like
12345) which is part of the same form as the button i want to make, to
launch an external applicaiton. I need the copied value in the external
application.

Bart

Nov 13 '05 #5
AA Arens wrote:
I want Access copies the contents of the field "postal code" (like
12345) which is part of the same form as the button i want to make, to
launch an external applicaiton. I need the copied value in the external
application.

Bart

I created a form with 2 text boxes; Text0 and Text2. In the AfterUpdate
event of Text0 I entered the following code
Me.Text0.SelStart = 0
Me.Text0.SelLength = Len(Me.Text0)
DoCmd.RunCommand acCmdCopy

When I moved to Text2 I could do an edit/paste and the value I entered
in Text0 would be filled in.

If you were in Access, you could use
DoCmd.RunCommand acCmdPaste

How you paste the value from the clipboard into an external app is
something you can do manually with a Ctrl+V or Edit/Paste from it's menu.

Use Shell to open the external app or else use one of the API calls
found at http://www.mvps.org/access.
Nov 13 '05 #6
AA Arens wrote:
I want Access copies the contents of the field "postal code" (like
12345) which is part of the same form as the button i want to make, to
launch an external applicaiton. I need the copied value in the external
application.

Bart

I created a form with 2 text boxes; Text0 and Text2. In the AfterUpdate
event of Text0 I entered the following code
Me.Text0.SelStart = 0
Me.Text0.SelLength = Len(Me.Text0)
DoCmd.RunCommand acCmdCopy

When I moved to Text2 I could do an edit/paste and the value I entered
in Text0 would be filled in.

If you were in Access, you could use
DoCmd.RunCommand acCmdPaste

How you paste the value from the clipboard into an external app is
something you can do manually with a Ctrl+V or Edit/Paste from it's menu.

Use Shell to open the external app or else use one of the API calls
found at http://www.mvps.org/access.
Nov 13 '05 #7
I get an error message: "Compile error: Method or data menmber not
found" (then SelStart is selected). I used the right control Control
Scource.
This is my script (I am aware of pasting in ext. app.):

Private Sub test_Click()
On Error GoTo Err_test_Click

Me.PostalCode.SelStart = 0
Me.PostalCode.SelLength = Len(Me.PostalCode)
DoCmd.RunCommand acCmdCopy
' DoCmd.RunCommand acCmdPaste
Dim stAppName As String
stAppName = "C:\Program Files\AutoHotkey\AutoHotkey.exe"
Call Shell(stAppName, 1)

Exit_test_Click:
Exit Sub

Err_test_Click:
MsgBox Err.Description
Resume Exit_test_Click

End Sub

Nov 13 '05 #8
Br
AA Arens <ba***********@gmail.com> wrote:
I get an error message: "Compile error: Method or data menmber not
found" (then SelStart is selected). I used the right control Control
Scource.
This is my script (I am aware of pasting in ext. app.):

Private Sub test_Click()
On Error GoTo Err_test_Click

Me.PostalCode.SelStart = 0
Me.PostalCode.SelLength = Len(Me.PostalCode)
DoCmd.RunCommand acCmdCopy
' DoCmd.RunCommand acCmdPaste
Dim stAppName As String
stAppName = "C:\Program Files\AutoHotkey\AutoHotkey.exe"
Call Shell(stAppName, 1)

Exit_test_Click:
Exit Sub

Err_test_Click:
MsgBox Err.Description
Resume Exit_test_Click

End Sub


Two things....

Your syntax is wrong. Use the exclamation mark (ie. Me![PostalCode]) not
the dot operator. It's good practice to use the square brackets too (you
have to if you put spaces in the control name which IMO is bad practice
anyway:)

Second, the field must have the focus before using these methods. So
your code should be.....

Me![PostalCode].Setfocus
Me![PostalCode].SelStart = 0
Me![PostalCode].SelLength = Len(Me![PostalCode])

Hope that helps.
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #9
After the reparaton, I now get an error message containing:

"OBject doesn't support this property or method"
(I use Access 2003)

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Trvl Orm | last post by:
I am working with 2 frames, Left and Right and the main code is in the left frame, which has been attached. Can someone please help me with this code. I am new to JavaScript and can't figure it...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
8
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled...
0
by: AA Arens | last post by:
I want to add a button doing the following: copying the value of a certain field (postal code)the present record and then start an external application. How to perform the first? Bart
2
by: Chris Millar | last post by:
Can anyone help me on converting this vb asp page to C#, thanks in advance. chris. <!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.0 transitional//EN"> <%...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.