Advertisement

03.27.2008 at 05:48PM PDT, ID: 23276166
[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!

Too few parameters.  Expected 2.
Tags: Access, 2007, Access 2007, Too few paramters.  Expected 2
I have an Access 2007 form with a list box (Me.lstPropWithDebits.Value) for the user to select a choice from.  I have a button to click where the selection should be copied to a table to generate a temporary list.  When I click on the button it puts a number in the table rather than what the list box displays.  I think it might be an index.  As part of troubleshooting I put an additional button on the screen to display what 'Me.lstPropWithDebits' is holding and the msgbox shows what I want to go into the table.  I have been going a little nuts over the past hour and hope you can help me out.  Thanks!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Private Sub cmdAdd_Click()
Dim strSQL As String
    strSQL = "insert into tblTmpLeases (Lease) " & vbCrLf & _
    "    values (" & Me.lstPropWithDebits.Value & ")"
    CurrentDb.Execute strSQL, dbFailOnError
    RefreshListBoxes
End Sub
 
Private Sub Command7_Click()
MsgBox (Me.lstPropWithDebits)
End Sub
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: jckingcpa
Solution Provided By: harfang
Participating Experts: 3
Solution Grade: A
Views: 5
Translate:
Loading Advertisement...
03.27.2008 at 05:51PM PDT, ID: 21227123

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.

 
03.27.2008 at 06:03PM PDT, ID: 21227176

Rank: Sage

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.

 
03.27.2008 at 06:05PM PDT, ID: 21227187

Rank: Sage

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.

 
03.27.2008 at 06:14PM PDT, ID: 21227216

Rank: Guru

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.

 
03.27.2008 at 06:39PM PDT, ID: 21227387

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.

 
03.27.2008 at 09:43PM PDT, ID: 21228079

Rank: Wizard

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.

 
03.27.2008 at 11:47PM PDT, ID: 21228406

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.

 
03.28.2008 at 12:02AM PDT, ID: 21228436

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.

 
03.28.2008 at 07:03AM PDT, ID: 21230457

Rank: Guru

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.

 
03.28.2008 at 07:42AM PDT, ID: 21230833

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.

 
03.28.2008 at 09:18AM PDT, ID: 21231755

Rank: Wizard

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
 
03.27.2008 at 05:51PM PDT, ID: 21227123
Shoot I forgot to tell you that I get the too few parameters error when I change the bound column to 1 rather than 0.   Also this appears to work ok in an earlier version of Access.  
 
03.27.2008 at 06:03PM PDT, ID: 21227176

Rank: Sage

First: remove the vbCrLf from this string ... a SQL string should be one continuous line:

strSQL = "INSERT INTO tblTmpLeases (Lease) VALUES(" & Me.lstPropWithDebits.Value & ")"

Is the Lease column a Text column? Probably not, as you indicate this did work at some point ...

Is this a multi-column listbox? If so, then the expression you've got will save the value of the Bound column (whatever that may be) to tblTmpLeases. You can refer to a specific column in a listbox (or combo) like this:

Me.lstPropWithDebits.Column(0)

Note that listboxes and combos are zero-based, so the above string refers to the First column ...

 
03.27.2008 at 06:05PM PDT, ID: 21227187

Rank: Sage

This is a bit confusing:

<a SQL string should be one continuous line:>

You can breakup a line in the Editor in several ways, but you should not use vbCrLf to do so ... you can do this:

sSQL = insert into tblTmpLeases (Lease) " &
  _ "    values (" & Me.lstPropWithDebits.Value & ")"

or

sSQL = insert into tblTmpLeases (Lease) " _
  & "    values (" & Me.lstPropWithDebits.Value & ")"

or

sSQL = insert into tblTmpLeases (Lease) "
sSQL = sSQL & " values (" & Me.lstPropWithDebits.Value & ")"




 
03.27.2008 at 06:14PM PDT, ID: 21227216

Rank: Guru

check the column count property and bound column property of your listbox design.
what value is 'Me.lstPropWithDebits' returning in your msgbox?
remember that bound column of 1 in  form design view is equivalent to bound column of 0 in the forms vba code (i.e the first column of your listbox)
also put the msgbox just before the insert statement.
also is the Lease field must be numeric according to your sql statement.
 
03.27.2008 at 06:39PM PDT, ID: 21227387
I have removed the vbCrLF.  Same results.  The lease field is not a text column and good catch.  Thanks.  I was trying everything and just copied my latest code.

This is not a multiy select list box.  The row source is attached below.

When I try Me.lstPropWithDebits.Column(0) I get the 'Too few parameters.  Expected 2' message.

The column count is 1 and the bound column is 0.
1:
2:
3:
4:
SELECT selOpenDebits.Lease
FROM selOpenDebits
WHERE (((selOpenDebits.Property)=[Forms]![frmLeaseSelection]![cboProperty]))
GROUP BY selOpenDebits.Lease;
Open in New Window
 
03.27.2008 at 09:43PM PDT, ID: 21228079

Rank: Wizard

When you get the error, enter debug mode, open the immediate pane (Ctrl+G) and type:

    ? strSQL

Post the answer here, if you like, or examine it yourself: copy the string into a new query in SQL view and try to run it. You will at least get the names of the missing parameters. I do suspect that you are trying to insert text without quotes.

(°v°)
 
03.27.2008 at 11:47PM PDT, ID: 21228406
I get...
? strSQL
insert into tblTmpLeases (Lease) values (PAR-WIL003)
Which is exactly what I want (PAR-WIL003)  the table recorded '1'.  
Thanks for your help!
 
03.28.2008 at 12:02AM PDT, ID: 21228436
When I try to run the query in a new view I get prompted for a parameter named PAR. I assume it is because there is a dash "-" in the string.  If I am correct do you have suggestions around this?
 
03.28.2008 at 07:03AM PDT, ID: 21230457

Rank: Guru

your lease field is a text (string) field so you are missing single quotes in your code.
ie me.lstPropWithDebits.values need to be wrapped with single quotes like below

strSQL = " insert into tblTmpLeases (Lease)  values ('" & Me.lstPropWithDebits.Value & "')"

copy and paste it into your vba module and you wil be able to see the difference.
 
03.28.2008 at 07:42AM PDT, ID: 21230833
I made the change and unfortunatly I am still gettng the index value returned rather that the lease number.  Column count is 1 and bound column is 0.  Thanks.
 
03.28.2008 at 09:18AM PDT, ID: 21231755

Rank: Wizard

That is what bound column 0 means: you want the index number, and not the displayed value, which I guess is what you call the "lease number". However this contradicts your SQL:

insert into tblTmpLeases (Lease) values (PAR-WIL003)

PAR-WIL003 is clearly not the "index value", or this what you meant by it? Incidentally, your query is as I expected: with text. As frankytee already said, this is what you want (unless you are in fact expecting a numeric value, I'm getting confused about your use of "number"...)

insert into tblTmpLeases (Lease) values ('PAR-WIL003')

If your combo has one column, and that column is what you want to insert, set Bound Column to 1, or specifically request the first *data* column:

strSQL = " insert into tblTmpLeases (Lease)" _
    & "  values ('" & Me.lstPropWithDebits.Column(0) & "')"

(°v°)
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628