Interactive Forms

S

Steven V. Olson

I am having trouble with the following code for Office
2000 vba. I am attempting to open a form with control
buttons that input text into a text box on a different
form.

First, I open a form named "Select Lens Or Segment Styles
Form", which contains the selection buttons. The following
subrouting accomplishes this task nicely:

Private Sub Command165_Click()
On Error GoTo Err_Command165_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Select Lens Or Segment Styles Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command165_Click:
Exit Sub

Err_Command165_Click:
MsgBox Err.Description
Resume Exit_Command165_Click

End Sub

'This subroutine opens a form named "Select Lens Or
Segment Styles Form"


Next, I click on a command button on this form. The
command button closes the the form named "Select Lens Or
Segment Styles Form", which it performs correctly.

However, the next commands are not executing. I am asking
that the words "S.V. Polycarb." be entered into a text box
named LensOrSegmentStyles which is on the previously
active form named "Patient Safety Rx Order Form" Finally,
the last command askes that the form data be refreshed.



Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

DoCmd.Close

'This command closes the form named "Select Lens Or
Segment Styles Form"

LensOrSegmentStyles = "S.V. Polycarb."

' This command types the text "S.V. Polycarb." Into
the text box named LensOrSegmentStyles.

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, ,
acMenuVer70

' This command refreshes the screen

Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub


No errors occur when the commands buttons are pressed,
however, no words appear in the text box. See the code
below. Can someone help me correct this code so that it
functions properly?

Sincerely,

Steven V. Olson, (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top