Forms Will Not Interact With Each Other

S

Steven V. Olson

I am having trouble with the following code for Office
2000 vba. I am attempting to open a form which contains
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
subroutine 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.
See the code below:



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 command buttons are pressed,
however, no words appear in the text box either. Can
someone help me correct this code so that it functions
properly? Please e-mail responses to (e-mail address removed).

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