Advertisement

05.06.2008 at 11:28PM PDT, ID: 23381786
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Using memo type with parameterized query

Tags: Microsoft, Access, 200., SQL
Hello there.

I have a working paramterized query as below, which is supplied parameters and executed within some VB code.

PARAMETERS parm1Name Text ( 255 ), parm2Athr Text ( 255);
INSERT INTO TrackListTbl ( Name, Athr, )
VALUES (parm1Name, parm2Athr);

As parm1Name can exceed 255 characters, I'd like to use the memo type and would very much appreciate it if you could help me with the syntax of this.
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: numoonriot
Solution Provided By: peter57r
Participating Experts: 2
Solution Grade: A
Views: 22
Translate:
Loading Advertisement...
05.07.2008 at 12:17AM PDT, ID: 21513778

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 12:22AM PDT, ID: 21513798

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 12:23AM PDT, ID: 21513804

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:22PM PDT, ID: 21527650

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:00PM PDT, ID: 21527967

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:11PM PDT, ID: 21528047

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 02:34PM PDT, ID: 21528673

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 02:59PM PDT, ID: 21528830

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 03:34PM PDT, ID: 21529033

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 04:10PM PDT, ID: 21529204

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 06:36PM PDT, ID: 21529856

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 02:55PM PDT, ID: 21578298

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 02:59PM PDT, ID: 21578322

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 03:01PM PDT, ID: 21578327

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.07.2008 at 12:17AM PDT, ID: 21513778

Rank: Genius

Based on the sql that Access creates when you declare a parameter as memo then you remove the (255) from your sql.

I see that you are supplying the parameter vaues through code - as far as I know that is the only method that might work. You can never type more than 255 characters into a parameter prompt even if you declare a parameter as memo.
Accepted Solution
 
05.07.2008 at 12:22AM PDT, ID: 21513798

Rank: Genius

Remove the (255) and the parameter becomes a Memo parameter (same as selecting Memo in the dialog).

(°v°)
 
05.07.2008 at 12:23AM PDT, ID: 21513804

Rank: Genius

sorry peter... (^v°)
 
05.08.2008 at 12:22PM PDT, ID: 21527650
Thanks for this peter57r and harfang.

Unfortunately, when I remove the (255), save the query, then open it again (in SQL view), the (255) pops back as if I'd never deleted it!

i.e. Initial SQL

PARAMETERS parm1Name Text ( 255 ), parm2Athr Text ( 255);
INSERT INTO TrackListTbl ( Name, Athr, )
VALUES (parm1Name, parm2Athr);

I modify it as follows

PARAMETERS parm1Name Text , parm2Athr Text ( 255);
INSERT INTO TrackListTbl ( Name, Athr, )
VALUES (parm1Name, parm2Athr);

However, when I save, close and reopen query, it reverts to

PARAMETERS parm1Name Text ( 255 ), parm2Athr Text ( 255);
INSERT INTO TrackListTbl ( Name, Athr, )
VALUES (parm1Name, parm2Athr);

Im therefore unable to test the modified query with my (VB) code. Any ideas?

peter57r, as you say you can never type more than 255 characters into a parameter prompt even if you declare a parameter as memo, is this method doomed to fail even if I manage to permanently delete (255) from after PARAMETERS parm1Name Text in the query.

(Just to be absolutely and probably unnecessarily clear, I'm not typing any characters into a prompt, these are being passed by VB code.)

Thanks again.
 
05.08.2008 at 01:00PM PDT, ID: 21527967

Rank: Genius

If you are passing the data from a program variable or similar, then there is no typing involved so the 255 limit does not apply.

I don't know what's going on with your parameters but I suggest that you go into the parameter settings in query design view and choose a memo datatype for each and see if that sorts it out.
 
05.08.2008 at 01:11PM PDT, ID: 21528047
Thanks again peter57r

Where are the parameter settings in query design view?

When I go into this view all I see are Field: Table: Sort: Append To: Criteria: or: etc.

(In my table, the relevant field is assigned Memo datatype.)

Thanks again
 
05.08.2008 at 02:34PM PDT, ID: 21528673

Rank: Genius

Query menu> Parameters
 
05.08.2008 at 02:59PM PDT, ID: 21528830

Rank: Genius

You are right. Text alone as parameter type doesn't go well with the internal SQL parser. If you don't choose a length, you get the default length of 255. However, this works:

PARAMETERS parm1Name Text ( 6000 ), parm2Athr Text ( 255 );
INSERT INTO TrackListTbl ( Name, Athr )
VALUES (parm1Name, parm2Athr);

It's a bit strange that the query grid should produce the type "Text" (and save it correctly if you save from the design view), but that the parser should "correct" it.

Anyway, it's not such a big deal if you use ADO, since you need to redefine your parameters and that parameter type matching seems to be rather lax. If you use DAO, the parameter type will be dbText (not dbMemo), but it will accept the 6000 characters happily.

(°v°)
Assisted Solution
 
05.08.2008 at 03:34PM PDT, ID: 21529033
Thanks peter57r and harfang. I'll give these both a go and get back to you. (I'm afraid I don't know the difference between ADO and DAO, but hopefully that won't stop me trying this).

As a matter of interest, will specifing a size of 6000 use a lot of memory or slow the code down a lot?

 
05.08.2008 at 04:10PM PDT, ID: 21529204
Hello again folks.

peter57r, I've found that even when you use Query menu> Parameters, the code will revert to (255).

I've noticed that my VB code is actually giving me an error, when it encounters the offending string longer than 255 characters. This means I can't yet actually test harfang's (6000) solution and close this question down.

I would propose trying to solve the problem with the VB (I will ask another question in ee), then testing harfang's (6000) solution.

I hope this is acceptable.

 
05.08.2008 at 06:36PM PDT, ID: 21529856

Rank: Genius

This is weird. I thought I had tested the above with DAO, but I can't reproduce it. Maybe I mixed up my tests.

Anyway, it seems that the DAO parameters are limited to basic types, even if the query specifies Memo (i.e. 'Text') or long text (i.e. 'Text(6000)'). See my test functions below. Try with:

    AddTrack??? string(2000,"x"), "test"

(°v°)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
Sub AddTrackDAO(pstrName As String, pstrAthr As String)
 
    Dim mdb As DAO.Database
    Dim qdfNewTrack As DAO.QueryDef
 
    ' open mdb here
    
    Set qdfNewTrack = mdb.QueryDefs("qappTrackListTbl")
    With qdfNewTrack
        .Parameters("parm1Name") = pstrName
        .Parameters("parm2Athr") = pstrAthr
        .Execute
    End With
    
End Sub
 
Sub AddTrackADO(pstrName As String, pstrAthr As String)
 
    Dim conDb As ADODB.Connection
    Dim comNewTrack As ADODB.Command
    Dim prm As ADODB.Parameter
 
    ' open conDb database connection here
    
    Set comNewTrack = New ADODB.Command
    With comNewTrack
        .ActiveConnection = conDb
        .CommandText = "qappTrackListTbl"
        .CommandType = adCmdStoredProc
        Set prm = .CreateParameter _
            ("parm1Name", adVarChar, adParamInput, 6000)
        .Parameters.Append prm
        Set prm = .CreateParameter _
            ("parm2Athr", adVarChar, adParamInput, 50)
        .Parameters.Append prm
    End With
    
    ' ready to go:
    With comNewTrack
        .Parameters("parm1Name") = pstrName
        .Parameters("parm2Athr") = pstrAthr
        .Execute
    End With
    
End Sub
Open in New Window
 
05.15.2008 at 02:55PM PDT, ID: 21578298
Hello again peter57r and harfang.

You sucessfully answered my question about memo syntax in SQL, peter57r with the syntax and harfang with the Access tweak. That's why I'm splitting the points between you.

It turns out that the best way to solve my overall problem was to use the approach as described here -
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_DB/Q_23388003.html

Thanks again for all your help.
 
05.15.2008 at 02:59PM PDT, ID: 21578322

Rank: Genius

In a related question {http:/Q_23388003.html} I offered a different solution to add records to a table by using a DAO recordset. This prompted the following comment about the present thread:

> In a way working with you and peter57r on this caused me to abandon my initial approach for something better, so that question is not entirely relevant to the ultimate solution. Thanks again. numoonriot.

I think that the work done here, exploring Memo parameters and their limitations, is what ultimately led to the solution you are using now. In short, it's possible to declare Memo parameters for a query (although it's tricky), and it's possible to use them through ADO, but not through DAO.

Feel free to close this question as you see fit; my suggestion would be a split among participants (that is never wrong).

Cheers!
(°v°)
 
05.15.2008 at 03:01PM PDT, ID: 21578327

Rank: Genius

Sorry, I should have refreshed (I was "afk" for a while)...

Thanks, and success with your project!
(°v°)
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628