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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I pass a unbound field to a text field in another program

Status
Not open for further replies.

rjmdt

Programmer
May 17, 2002
38
US
I want to pass the text from an unbound text field to a program that access runs when a button is pushed. I've attached the code that calls the program. I've tried using the send keys but the program takes a few seconds to start and I don't know if I need to pause. I've seen this done, but haven't been able to figure it out.

Thanks for your help.

Dim Msg2, Style2, Title2, Help2, Ctxt2, Response2, MyString2 'Ask for label 2
Msg2 = "Do you want to print Content label ?" & Chr(13) & "Load " & Forms![labelmain]![Unimark].Form![Content Size] & " Labels" ' Define message.
Style2 = vbYesNo + vbQuestion + vbDefaultButton1 ' Define buttons.
Title2 = "Content label" ' Define title.
Help2 = "DEMO.HLP" ' Define Help file.
Ctxt2 = 1000 ' Define topic
' context.
' Display message.
Response2 = MsgBox(Msg2, Style2, Title2, Help2, Ctxt2)
If Response2 = vbYes Then ' User chose Yes.
MyString2 = "Yes" ' Perform shell command 2
Dim vall2 As String 'entire shell command 2
Dim y As Variant
vall2 = """C:\program files\Lmw32\lmwprint.exe"" /L=f:\labels\" & Forms![labelmain]![Unimark].Form![content label file name]
y = Shell(vall2, vbMaximizedFocus)
 
There are several ways to do this. Here are two:

1. You can use the openargs option to pass a value to the form that you are opening.

DoCmd.OpenForm "FormName" , , , , , , , OpenArgs

2. You can refer to the text in the text box with Forms!FormName!textboxname.Value in the second form.

dz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top