Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 29th, 2004, 01:49 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 2
Thanked 0 Times in 0 Posts
Default ADP - Listbox RowSource fm SPROC w/ Input Parms

I have an application that uses SQL Server 2000 as the backend and an MS-Access .ADP file as its front-end.

The front-end has an unbound form that contains a listbox, textbox, and a command button.

The listbox's RowSource is TableA. The listbox's column(0) is from Field_1 of TableA. It's column(1) (not visible) is the Prime Key of TableA.

When the OnClick event of the command button fires, the text box is checked for the presence of a text string. If the textbox is blank, ALL records of TableA are shown in the list box.

If the text box contains text, the list box shows all records whose Field_1 contains the text string from the text box (ie. LIKE '%<string>%').

I have a stored procedure that returns the desired recordset based on several input parameters (of which the contents of the text box is just one. For simplicity, I won't discuss the others here). I used a listbox because I want the user to have a "multi-select" capability. When they find all records containing their search string, they have the option of selecting one or more records and assigning values (not discussed here) to the selected records. Note: when the text box is blank, I can potentially return 20,000+ records.

My question is this: What is the best way to set the RowSource of the list box based on several input parameters including the contents of the text box? Can I use my stored procedure and pass it its input parameters? How?

If you could point me to an example of how to do this, I would really appreciate it.

Thank you ahead of time for any assistance you can provide!


--- Tom
__________________
--- Tom
 
Old May 8th, 2006, 01:12 PM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Tom.

I've been trying to do just what you are doing below. I'm hopeing that you can point me in the right direction.

I can't seem to get my function to reference the text box in my form.
My text box is [forms]![menusearch]![text0]

Below is the code in from the function designer.

SELECT [Unit Name], datadata, [SAP Name]
FROM [xxx\VillanRL].[Nextel Subscribers Temp]
WHERE ([Unit Name] LIKE N'%’ + N’" & [forms]![menusearch]![text0] &’ + N’%')


once I get this working I can publish it as a data page.

Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Formating ListBox output to input into a file craigl Pro Visual Basic 2005 1 July 1st, 2007 08:02 AM
Online FM Radio aarunlal ASP.NET 2.0 Professional 0 November 6th, 2006 11:43 PM
Setting dynamic values for @parms bsullins BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 February 17th, 2005 03:20 PM
Stored procedure as the rowsource for Report (ADP) Tero Access 1 May 12th, 2004 08:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.