473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Populate Form through a series of Combo Box selections

First Post - New member - I've searched the discussions available to no avail. I have, however, learned a few things in doing so. (Great Site -- Thanks)
My issue is as follows:

Access 2003/WinXP

I have created a task tracking database. On the main form, I have placed two combo boxes. The first (cboContact) lists the user that the task is assigned to.

record source =
Expand|Select|Wrap|Line Numbers
  1. SELECT Contacts.ID, Contacts.[First Name] FROM Contacts ORDER BY Contacts.[First Name]; 
  2.  
AfterUpdate Event =
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboContact_AfterUpdate()
  2. cboTask.Requery
  3. End Sub 
  4.  
The second (cboTask) lists only the tasks that the user in cboContact is responisble for.

record source =
Expand|Select|Wrap|Line Numbers
  1. SELECT Issues.ID, Issues.Title, Issues.[Assigned To] FROM Issues WHERE (((Issues.[Assigned To])=FORMS!Issues!cboContact)) ORDER BY Issues.Title; 
  2.  
the AfterUpdate event == I'm having some battles with this one, as you'll see after the on GetFocus code

onGetFocus event =
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboTask_GotFocus()
  2. If Len(Trim(Nz(cboContact, "") & "")) = 0 Then
  3. MsgBox "Please Specify Person Task Assigned To First"
  4. cboContact.SetFocus
  5. Else
  6. cboTask.Requery
  7. End If
  8. End Sub
  9.  
The form has multiple fields that I want to populate based on cboTasks choice. My combo boxes work. The form, however does nothing once the second box is populated. I've tried [Forms]![Issues]![cboTask] in the criteria of the query that is the forms record source. That doesn't work. I've tried the following code on the AfterUpdate event on cboTask and it doesn't work.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboTask_AfterUpdate()
  2.  
  3. ' Find the record that matches the control.
  4. Dim rs As Object
  5. Set rs = Me.Recordset.Clone
  6. rs.FindFirst "[Title] = " & Me![cboTask]
  7. If Not rs.EOF Then Me.Bookmark = 
  8. rs.Bookmark
  9.  
  10. End Sub 
  11.  
My tables are set up as follows:
tblContacts
ID - Autonumber
First Name - Txt ( I have the full name in this field )

tblIssues
ID-Autonumber -PK
Title - Txt
Assigned To - Nbr (This has a one to many relationship from Contacts (ID))
Opened By - Nbr
Opened Date - Date/Time
Status - Txt
Category - Txt
etc, etc ... about 10 other fields

I'm going in circles trying to figure this one out. I may be right on top of it. Most likely not.

Thank you in advance for your reply.
Jul 30 '07 #1
2 1635
MMcCarthy
14,534 Expert Mod 8TB
Try this ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboTask_AfterUpdate()
  2. ' Find the record that matches the control.
  3. Dim rs As Object
  4.  
  5.     Set rs = Me.Recordset.Clone
  6.     rs.FindFirst "[Title] = '" & Me![cboTask] & "'"
  7.     If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  8.  
  9. End Sub
  10.  
Aug 6 '07 #2
Thanks for your reply. I'll try that solution.

I did get it working using this one.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboTask_AfterUpdate()
  2. On Error Resume Next
  3.  
  4.     cboTask.SetFocus
  5.     If cboTask.Value > 0 Then
  6.         Me.Filter = "[ID]=" & cboTask.Value
  7.         Me.FilterOn = True
  8.     End If
  9.  
  10. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Me.Filter = "[ID]=0"
  3. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboTask_GotFocus()
  2. If Len(Trim(Nz(cboContact, "") & "")) = 0 Then
  3. MsgBox "Please Specify Person Task Assigned To First"
  4. cboContact.SetFocus
  5. Else
  6. cboTask.Requery
  7. End If
  8. End Sub
Aug 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Inquiring_Mind | last post by:
i am creating a database. i have the following question.. as per the specs... i need to be able to pull other forms from the master form using either a list or a combo box. what is the...
1
by: KMEscherich | last post by:
Using Access '97 Hi there, am wondering if someone can please help me with the following: I have a master table (T_INVESTIGATION) that contains the following fields as well as other fields. ...
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
5
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.