Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 15th, 2004, 12:59 PM
Cresosote65 Cresosote65 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Montreal, CANADUH
Posts: 8 Cresosote65 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Assigning query results to variables???

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

Reply With Quote
  #2  
Old March 15th, 2004, 01:53 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Sorry, it doesn't work that way

You need to use ADO or DAO recordset to do what you are after.

S-

Reply With Quote
  #3  
Old March 15th, 2004, 02:32 PM
Cresosote65 Cresosote65 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Montreal, CANADUH
Posts: 8 Cresosote65 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Solution found!

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

Reply With Quote
  #4  
Old March 15th, 2004, 03:21 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Good for you

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Assigning query results to variables???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT