Hi,
I tried passing a global variable in the general declaration section of a module in Form1 so that a recordset in a second module in Form2 could read the variable. Whenever, Form2 is loaded to read the below SQL syntax in the VB code, it comes with an error message "variable not defined" with SQLconnect highlighted. Any help on this problem would be appreciated. Thanks

Albert.


rsDat.Open SQLconnect,CnData, dbOpenDynamic


SQLconnect = "Select OrderID,OrderDate from Employees, Orders Where Employees.[EmployeeID] = Orders.[EmployeeID]" _
& " And Lastname='" & Combo1.Text & "'"