Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 May 20th, 2008, 10:49 AM
Authorized User
 
Join Date: Sep 2006
Posts: 73
Thanks: 6
Thanked 0 Times in 0 Posts
Default Solved - rs.FindFirst and Multiple Column ComboBox

Hello All:

I am having another problem with my record lookup. I might have multiple orders in the 'Orders Table' with the same name but different parameters (PrimaryWorkGroup, SecondaryWorkGroup). What is happening is if I have a record like this:

Order PrimaryWorkGroup SecondaryWorkGroup
-----------------------------------------------------
Glucose ED ED
Glucose ED-Council ED-Council

If I select the first one, the second one will display. If I select the second one, the second one will display

Another example:

Order PrimaryWorkGroup SecondaryWorkGroup
-----------------------------------------------------
Chem7 ED
Chem7 ED-Council

Note that there is no PrimaryWorkGroup..If I select either one it
will display the first one.

The issue has to do with multiple orders. If there is a singular order and I select it, it will display fine. Any ideas?

I am using Access XP. I have an unbound combo box that is set for displaying three columns and the bound column is one. I have a query in the rowsource as follows:

SELECT DISTINCT [OrderName], [PrimaryWorkGroup], [SecondaryWorkGroup] FROM Orders ORDER BY [OrderName], [PrimaryWorkGroup], [SecondaryWorkGroup];

Here is what I have in my after_update subroutine:

Private Sub cbosOrderName_AfterUpdate()
Set rs = Me.Recordset.Clone
rs.FindFirst "[OrderName] = '" & Me![cbosOrderName] & "'"

'rs.FindFirst ("[OrderName] = '" & Me![cbosOrderName] & "' AND '[PrimaryWorkGroup] = '" & Me.cbosOrderName.Column(3) & "' AND '[SecondaryWorkGroup] = '" & Me.cbosOrderName.Column(4) & "'")
If Not rs.EOF Then Me.Bookmark = rs.Bookmark


Thank you for any advice,
Tony
 
Old May 20th, 2008, 03:21 PM
Authorized User
 
Join Date: Sep 2006
Posts: 73
Thanks: 6
Thanked 0 Times in 0 Posts
Default

I resolved it. I created an autonumber primary key which made the table unique and then it worked fine.

I also added this:

rs.FindFirst "[OrderNumber] = " & Str(Nz(Me![cbosOrderName], 0))


Tony






Similar Threads
Thread Thread Starter Forum Replies Last Post
Solved-RS.FindFirst and Multiple Column ComboBox eusanpe Access VBA 0 May 19th, 2008 01:25 PM
SOLVED -- Overriding OnTextChanged of ComboBox dparsons C# 1 January 17th, 2007 02:50 PM
update multiple records (solved) dhaywirex Classic ASP Databases 2 February 24th, 2004 12:23 AM
Multiple column for combobox in C# twaghorn C# 1 July 14th, 2003 04:10 AM





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