|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Here's my problem. I'm trying to assign a query result to two variables that I will use in an OuputTo method. The code looks like this:
Dim strEmpEmail As String Dim strCustName As String strEmpEmail = [qryExportQuoteRecTitle]![EmpName] strCustName = [qryExportQuoteRecTitle]![CustName] When I run this, I get the following message: "Run-time error '2465' Microsoft Access can't find the field "|" referred to in your expression." What bugs me most is that should be very simple, I just can't figure it out though. Any help will be greatly appreciated. Creo |
|
#2
|
|||
|
|||
|
Sorry, it doesn't work that way
You need to use ADO or DAO recordset to do what you are after. S- |
|
#3
|
|||
|
|||
|
Thanks for the advice, but I realized that if I create two text boxes in the form that runs the script, and assign variables to them, it will work by simply declaring the form objects rather than the whole query.
The script now looks like this: Private Sub cmbChooseQuote_AfterUpdate() Dim strEmpEmail As String Dim strCustName As String strEmpEmail = [txtEmpEmail] strCustName = [txtCustName] DoCmd.SendObject acSendQuery, "qryExportQuote", acFormatXLS, strEmpEmail, , , "New quote, " & strCustName End Sub This totally works. What it does is to automatically assign the email address of the employee that was chosen in the input form, as well creating a concatenated string that includes the customer number based on that same input form. Thanks, life is good again!!! Creo |
|
#4
|
|||
|
|||
|
Good for you
S- |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Assigning query results to variables??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|