473,396 Members | 1,608 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,396 software developers and data experts.

Two different combo boxes should display the data in subform

Hello!!

I have a mainform & subform and two combo boxes.
Data: combo box 1 has user name and combo 2 has user id
scenario: when I select user name (from combox 1) appropriate user id must display in combox box 2 and display the realted data in subform.

example:
Name1
User1 should display

User1 Name1 environemnt Profile ....

I have the below code but as soon as I select as combo 2, the subform data is going to default not the user that I select.
when I click on select all command button

Expand|Select|Wrap|Line Numbers
  1. 'Dim db As DAO.Database
  2. 'Dim rs As DAO.Recordset
  3. '
  4. 'Set db = CurrentDb
  5. 'Set rs = db.OpenRecordset("tblUsernameuserid")
  6. 'Do While Not rs.EOF
  7. 'rs.Edit
  8. 'rs!UseThisID = 1
  9. 'rs.Update
  10. 'rs.MoveNext
  11. 'Loop
  12. '
  13. 'rs.Close
  14. 'Set rs = Nothing
  15. 'Me.Requery
Jul 24 '19 #1
1 853
twinnyfo
3,653 Expert Mod 2GB
atest3894,

Welcome to Bytes!

It's quite difficult to see how your code has anything to do whatsoever with the intended outcome. As I read your code (which is all commented out, so it won't do anything, anyways), you are setting each UseThisID field in tblUsernameuserid to 1. That doesn't come close to doing anything you describe.

Now, I'm not sure the reason for the second combo box, because if you are selecting a User from the first combo box, you should be able to simply filter your sub-form using this combo box (as it appears the data is related).

Not knowing any field names, how your combo boxes have their row sources set up or anything else, I can't give you an exact answer. But the basics of what you would want to do is this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboComboBox1_AfterUpdate()
  2.     With Me.fsubSubFormName.Form
  3.         Filter = "UserID = " & Me.cboComboBox1
  4.         FilterOn = True
  5.     End With
  6. End Sub
That's the basics, but my guess is that your combo boxes probably have some design flaws, so this won't work initially. More details would hepp.

Hope this hepps!
Jul 25 '19 #2

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

Similar topics

2
by: CSDunn | last post by:
Hello, In an Access 2000 ADP subform, I have a set of two Radio buttons in a single group that are bound to a field called 'Completed'. The Completed field comes from an SQL Server 2000 table, is...
1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
0
by: cognoscento | last post by:
I'm currently putting together a database for my work (not an expert by any stretch, so muddling through as best as I can... you know the story...) and I could use some advice and hand-holding ...
3
by: Mike Jakes | last post by:
I hope that someone can offer a little advice on this one - I've searched the group but can't find an answer. I think that I'm doing something really stupid or missing something trivial, but see...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
by: SPOILED36 | last post by:
I am building a database to track attendance. I have one main form with multiple subforms. Within one of the subforms name sfrDailyAttendance, I also have cascading combo boxes (cboCategory and...
5
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect...
3
by: Outback | last post by:
Hi. Windows XP + Access 2002. I have three tables. tblMakes ======= MakeKey (PK) Make tblModels
7
by: cliffschooling | last post by:
I've used Access for some time but nver had to use any code. Ive a problem getting combo boxes to cascade in a sub form, I've done some searches and the problem appears to be in the identifaction of...
1
by: bobbe1338 | last post by:
How do I calculate the age of the user if he chooses the month, day and year from 3 different combo boxes and display the age in a textfield?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.