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

Form search criteria

Hi ,

I am trying to create an access form with a search on the group name and all the related group IDs on this particular group name must be displayed in the combo box on the form . The group name is same but the group numbers are unique..

Group name: Group Number:

Carribou Coffee 12345
Carribou Coffee 63726
Carribou Coffee 19827

So when i search for Carribou Coffee ....It needs to show me all the related numbers in the list.....

This is the query i wrote for search button....Right now with this it only displays one value.....I want all values.....

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Dim Db As Database
  3. Dim RsGrpName As DAO.Recordset
  4.  
  5. Private Sub cmdGroupNameSearch_Click()
  6. Set RsGrpName = Db.OpenRecordset("SELECT DISTINCT Grp_Number,Grp_Name FROM EmployerGroup Where Grp_Name Like'" & Trim(txtGroupName) & "'")
  7.  
  8. If RsGrpName.RecordCount > 0 Then
  9.  
  10. cboGroupNumbers = RsGrpName.Fields("Grp_Number")
  11. Else
  12. MsgBox "Data Not Available...", vbQuestion
  13. End If
  14.  
  15. End Sub
  16.  
  17. Private Sub form_load()
  18. Set Db = CurrentDb()
  19.  
  20. End Sub
  21.  


waiting for a help from some one....
Thanks,
Jason...
Oct 18 '07 #1
6 1441
Rabbit
12,516 Expert Mod 8TB
It should be:
Expand|Select|Wrap|Line Numbers
  1. cboGroupNumbers.RowSource = "SELECT DISTINCT Grp_Number FROM EmployerGroup WHERE Grp_Name Like '" & Trim(txtGroupName) & "';"
  2.  
Oct 18 '07 #2
It should be:
Expand|Select|Wrap|Line Numbers
  1. cboGroupNumbers.RowSource = "SELECT DISTINCT Grp_Number FROM EmployerGroup WHEREGrp_Name Like '" & Trim(txtGroupName) & "';"
  2.  
Hi,

Thanks for the solution that worked for me.....

I have another question in the same GroupName field now i have to type the whole name and then i say search so that it will get the group numbers....

But is there any way that i start typing and it will display all the related names that start with those letters and allow me to pick from them.. so that my intension is that if the user miss spells one word there wont be much difference as we give him the list of all names....Is that possible....

Please help me with the code changes...
As iam learning VB and using for the first time...I dont know much tricks in it....

Thanks for ur help.....
Will be waiting to hear something......
Jason...
Oct 18 '07 #3
NeoPa
32,556 Expert Mod 16PB
Check out Example Filtering on a Form for a full rundown, but Rabbit's right in that he highlighted the fundamentals of where your code goes wrong.
You don't do it with a recordset. You set the RecordSource to the SQL you want.
Oct 18 '07 #4
NeoPa
32,556 Expert Mod 16PB
...
But is there any way that i start typing and it will display all the related names that start with those letters and allow me to pick from them.. so that my intension is that if the user miss spells one word there wont be much difference as we give him the list of all names....Is that possible....
Check out the AutoExpand property of the ComboBox control.
Oct 18 '07 #5
Need Help with combo box display
--------------------------------------------------------------------------------

Hi,

I have a form and i have a combo box that gets loaded with the last name and first name being concatenated at the time of loading into the combobox and i select from that list ...

So the problem is if i select any name then it is breaking up and moving into a second line in the combobox..

Example:

Jason Meyers ----- I select this


Result

Jason
Meyers ---- I dont want it to be like that


I want it to be in the same line as it was displayed and need to remain like that after selection.....


Desired Result:

Jason Meyers




Waiting for help

Thanks
Jason.
Oct 27 '07 #6
NeoPa
32,556 Expert Mod 16PB
Jason,

Some of this is clear :)
What is not clear is where this name is displaying wrongly. Is it in the ComboBox itself (after selection)? Or is the value used elsewhere?
Something that would be helpful too is the source settings of the ComboBox. Does it use a query (if so post in the SQL)? Is it a value list (If so post in the value list)?
Oct 27 '07 #7

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

Similar topics

2
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks...
2
by: RBohannon | last post by:
I have a report with most fields populated by a query. However, some of the fields are variable in such a way that their values cannot be queried from a table. At present the values for these...
3
by: dskillingstad | last post by:
I'd appreciate any help I can get. I'm not sure what I'm doing wrong, but.... I've searched these groups for some solutions but no luck. I have an unbound form (frmSearch), with several unbound...
10
by: motessa | last post by:
Hello All, I am new to Access and have been looking for answers to my problem on the internet and have not found it yet. I hope someone can give me a hint. Thanks so much. I have a form...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
5
by: SeanCly10 | last post by:
Hi all. I don't want to sound like a complete idiot here, but I'm somewhat limited in my coding knowledge, and I need some advice and help. I'm working on a database that will eventually be used...
31
by: DWolff | last post by:
I'm somewhat new to Access, and have no VB experience at all (except for modifying existing code where obvious). I built a data entry form that works fine. Typically, a client will call in and...
1
by: jcf378 | last post by:
Hi all-- Does anyone have any insight as to how I might create a search form that allows a user to select criteria based on any related table in the whole database. The search form I have now only...
2
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 2:...
8
by: hollinshead | last post by:
Hi there i have bit of an issue. i haver this database that is purely used for searching records under certain criteria. This criteria is chosen by the user on a form using list boxes and combo...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.