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 6th, 2005, 04:58 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When it hits the strVendorNum = line it gives me an "Object Required" error message.

 
Old December 6th, 2005, 05:04 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, I fixed that error, but now when I run the query it is asking me for strVendorNum in a dialog box.

 
Old December 6th, 2005, 05:09 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Any chance you could copy the code and paste it in a posting, or email it to me?

Mike
EchoVue.com
 
Old December 6th, 2005, 05:13 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Edit: Editing out since code didn't work, no sense having non-functioning code lying around.
 
Old December 6th, 2005, 05:18 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Before I look at it too hard, try and replace the asterisk's (*) with percent signs (%) for some reason Access uses one in the Query Builder and a different one from VBA.


Mike
EchoVue.com
 
Old December 6th, 2005, 05:22 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Substituting % for * in the first query resulted in no records being returned.

 
Old December 6th, 2005, 06:25 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You then need to ensure that the search string is surrounded in quotes as well.

LIKE '%' & '" & strSrch & "' & '%'



Mike
EchoVue.com
 
Old December 6th, 2005, 06:31 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That query is already working with the asterisks, it returns the PCAGE & ACAGE columns associated with a given full or partial part number. It is the second query where the vendors are compared to the list of vendors in the ACAGE column (boo to bad database design) that is giving me fits. Thanks for the help, if I still can't get it working tomorrow I'll be back!

 
Old December 6th, 2005, 06:33 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Sounds good - I am about to head for the night as well.

All the best,

Mike

Mike
EchoVue.com
 
Old December 7th, 2005, 08:12 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Success! Found this on the web today and was able to leverage off it to find the code I needed!
http://www.techonthenet.com/access/q...ke_textbox.php

Here's the SQL statement that worked, as entered into VBE:
    sql_q = "SELECT DISTINCT * " & _
            "FROM Vendor, qryPartSearch " & _
            "WHERE (qryPartSearch.PrimVendor = [Vendor]![id]) OR (qryPartSearch.AltVendor Like '*' & [Vendor]![id] & '*' ) " & _
            "ORDER BY id;"

Edit: By the way, is it possible to make the ORDER BY statement such that it puts the PrimVendor listing first, and the rest in numerical order afterwards?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Return one record per value fizzerchris SQL Server 2005 4 August 17th, 2007 09:31 PM
Return to Inserted Record - FormView rit01 ASP.NET 2.0 Basics 15 January 27th, 2007 12:04 PM
return record count by quarter jtyson SQL Server 2000 1 June 29th, 2004 11:24 PM
Return the last record altered MikeJames42 VB How-To 1 February 13th, 2004 12:57 PM
Return a Record set into a table? morpheus Classic ASP Basics 2 November 18th, 2003 11:38 AM





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