Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2005

Tip: Looking for answers? Try searching our database.

Determining howmany/which

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Evan M - 31 Dec 2004 17:38 GMT
Hello, I am looking to generate a PO from an order form that has a subform
that contains the companyname of who we will be issuing the PO to. In most
cases we will not have a problem, but occasionally we will need  to order
from multiple vendors. How is it that, in code, I can determine if there are
multiple vendors? I think i can do the rest, but I'm stuck at this point.
Thanks for any assistance!

Evan M
evan AT radiologyonesource DOT com
Wayne Morgan - 31 Dec 2004 19:34 GMT
Depending on your sort order, if the first and last record both have the
same vendor, then there is only one vendor. Probably a better option though
would be to run a query to open a recordset on the subform's recordset. The
only field you will need returned is the vendor's id field and you would
tell the query to return only unique ones. The number of records in the
recordset would be then number of vendors.

Example:
Dim rst As DAO.Recordset, intNumberOfVendors As Integer
Set rst = CurrentDb.OpenRecordset("Select Distinct [VendorID] From tblOrders
Where [OrderID]=" & Me.txtOrderID, dbOpenSnapshot)
rst.MoveLast
intNumberOfVendors = rst.RecordCount
Debug.Print "Number of Vendors = " & intNumberOfVendors
rst.Close
Set rst = Nothing

Signature

Wayne Morgan
MS Access MVP

> Hello, I am looking to generate a PO from an order form that has a subform
> that contains the companyname of who we will be issuing the PO to. In most
[quoted text clipped - 5 lines]
> Evan M
> evan AT radiologyonesource DOT com
Evan M - 03 Jan 2005 14:53 GMT
Thanks Wayne! I'll give it a shot!

Evan Mc
evan AT radiologyonesource DOT com

> Depending on your sort order, if the first and last record both have the
> same vendor, then there is only one vendor. Probably a better option
[quoted text clipped - 22 lines]
>> Evan M
>> evan AT radiologyonesource DOT com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.