A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DAO parameter length



 
 
Thread Tools Display Modes
  #1  
Old June 26th, 2008, 05:56 AM posted to microsoft.public.access.queries
Joseph Walkenhorst
external usenet poster
 
Posts: 1
Default DAO parameter length

When I run the code below an error is thrown at line 4 when the string
sc.notes is greater than 255 characters.
Is there any way to allow parameters to contain more than 255 characters?

1 Public Function saveSCToDB(sc As Scorecard, query_Name As String) As Boolean
2 Dim qdf1 As DAO.QueryDef
3 Set qdf1 = EMAT_DB.QueryDefs(query_Name)
4 qdf1.Parameters("[@Notes]") = sc.Notes
....
  #2  
Old June 26th, 2008, 12:50 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default DAO parameter length

Maybe. Try declaring the parameter "@Notes" as a memo type in your query.

Parameters [@Notes] Text;
SELECT ....


Otherwise try truncating your reference to sc.notes to 255 characters. I find
it hard to imagine that you would get many extra records returned with 255
characters for a match.


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Joseph Walkenhorst wrote:
When I run the code below an error is thrown at line 4 when the string
sc.notes is greater than 255 characters.
Is there any way to allow parameters to contain more than 255 characters?

1 Public Function saveSCToDB(sc As Scorecard, query_Name As String) As Boolean
2 Dim qdf1 As DAO.QueryDef
3 Set qdf1 = EMAT_DB.QueryDefs(query_Name)
4 qdf1.Parameters("[@Notes]") = sc.Notes
...

  #3  
Old June 27th, 2008, 11:50 AM posted to microsoft.public.access.queries
Bob Barrows [MVP]
external usenet poster
 
Posts: 441
Default DAO parameter length

Joseph Walkenhorst wrote:
When I run the code below an error is thrown at line 4 when the string
sc.notes is greater than 255 characters.
Is there any way to allow parameters to contain more than 255
characters?

1 Public Function saveSCToDB(sc As Scorecard, query_Name As String)
As Boolean 2 Dim qdf1 As DAO.QueryDef
3 Set qdf1 = EMAT_DB.QueryDefs(query_Name)
4 qdf1.Parameters("[@Notes]") = sc.Notes
...

Unfortunately, according to the Access specifications:

Attribute
Maximum
Number of characters for a parameter in a 255
parameter query


You either have to use dynamic sql or a recordset. I would suggest the
latter.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 




Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.