Value of a variable

J

Joanne

Hello,
I have a Case statement inside a subroutine as follows
Sub Trvw_NodeClick(ByVal Node As MSComctlLib.Node)
Select Case Node.Key
Case "Root0"
vText = "Parties Appellant"
DoCmd.OpenForm "FrmTextSearch"
Form_frmTextSearch.txtLabel.SetFocus
Form_frmTextSearch.txtLabel.Text = "Enter information for " & vText
Form_frmTextSearch.List6.SetFocus
Form_frmTextSearch.RecordSource = "tblPatentCaseInformation"
Form_frmTextSearch.List6.SetFocus
vstrSearch = Form_frmTextSearch.List6.Text

End Select

I want to pass the value of "vstrSearch" to the click event on a command
button of a second form. The code of the click event looks like this:

Public Sub btnSearch_Click()
MsgBox "The variable's value is " & vstrSearch
Dim StrSQL As String
StrSQL = "SELECT Citation, CaseName, [Parties-Appellant] " _
& " FROM tblPatentCaseInformation" _
& " WHERE [Parties-Appellant]=' " & vstrSearch & "' " _
& " ORDER BY CaseName"

DoCmd.OpenReport "CaseInformation", acViewDesign, , , acHidden
Reports!CaseInformation.RecordSource = StrSQL
DoCmd.Close acReport, "CaseInformation", acSaveYes
DoCmd.OpenReport "CaseInformation", acViewPreview
_________________________

But the value of the variable vstrSearch does not get passed to the click
event in this second form. I added a module and declared "vstrSearch" as a
global variable but this didn't work either. I put a message box at the very
top of the click event for this second form, to display the value of the
variable but the variable does not have a value. The value is displayed if I
put a message box in the select statement of the first form. I hope I have
provided enough information for this problem. I've been told that I'm not
clear in my requests. Thanks so much for any help. I'm learning a lot from
this forum - painfully - but I am learning.
 

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