473,699 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

search form using combo boxes and relates tbls

3 New Member
Hello
I'm having serious troubles creating a seach form showing data from multiple tbls, I'll try to explain my problem using a simple example
by the way I'm using Acces 2003

Expand|Select|Wrap|Line Numbers
  1. tblEquipment 
  2. equipment ID
  3. description
  4. brand ID
  5. price 
  6. ...
  7.  
  8. tblBrand 
  9. brand ID 
  10. brand
these 2 tbls are linked using the brand ID (one to many)

now I trying to construct a continuos form with in the form header, a unbound combo box showing all possible brand names, an unboud text box for Description and a cmdFilter button

and in de detail section a dataview showing the filtered records.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdFilter_Click()
  2.     Dim strWhere As String                 
  3.     Dim lngLen As Long                   
  4.  
  5.     If Not IsNull(Me.txtFilterDescription) Then
  6.         strWhere = strWhere & "([Description] = """ & Me.txtFilterDescription & """) AND "
  7.     End If
  8.  
  9.     If Not IsNull(Me.cboFilterBrand) Then
  10.         strWhere = strWhere & "([Brand] = " & Me.cboFilterBrand & ") AND "
  11.     End If  
  12.  
  13.     lngLen = Len(strWhere) - 5
  14.     If lngLen <= 0 Then     
  15.         MsgBox "No criteria", vbInformation, "Nothing to do."
  16.     Else                    
  17.         strWhere = Left$(strWhere, lngLen)
  18.  
  19.         Me.Filter = strWhere
  20.         Me.FilterOn = True
  21.     End If
  22. End Sub
the filtering on the textbox works fine but the combo box is giving problems , I can work with the ID but not wirth the actual brands , know it has something to do with using a query that includes the lookup table as well but don't know ho to do this
please help

thanks in advance
Regards
Simon
Feb 16 '07 #1
5 1883
NeoPa
32,569 Recognized Expert Moderator MVP
Let me know if there is anything that (Example Filtering on a Form.) doesn't explain for you.
Feb 16 '07 #2
Simon Jans
3 New Member
Hi NeoPa thanks for replying so quikly

using the formfiltering dbase as example I would like to see the account type (customer or supplier) in the filtered account type combo box instead of the index number (0,1 or 2)

by the way in the example you use a value list but I need to use a linked table as rowsource but I suppose that doesn't make a difference

regards
Simon
Feb 16 '07 #3
NeoPa
32,569 Recognized Expert Moderator MVP
I will just quote from something Rabbit's working on atm as a new Tutorial.
ASSUMPTIONS
We will use a simple scenario for this tutorial. You have an unbound form with two combo boxes. One named [Company] and the other named [Employee Name]. [Company] will get its values from table TblCompany while [Employee Name] will get its values from TblEmployees. The tables have the following layout:
Code:
TblCompany
[ID] – AutoNumber, PK
[CpyName] – Text, Name of the Company

TblEmployees
[EmpName] – Text, Name of Employee
[ID] – FK, Used to link the employee to the company from which they work.
[EID] – Autonumber, PK

As a default, [Company] will have the following properties:
Row Source – TblCompany
Column Count – 2 (We use 2 columns because we want to include both ID and CpyName.)
Column Widths – 0”;1” (We set the first column to 0” because the user does not need to see the ID.)
Bound Column – 1 (We bind it to the first column so that when we refer to [Company], it will return the ID rather than CpyName.)

And [Employee Name] will have no options because we want it to be empty until a company has been chosen.

Your needs will determine how you will set up your combo/list boxes and tables.
This should answer your question :)
Feb 17 '07 #4
Simon Jans
3 New Member
OK it's working now

thanks a lot

Simon
Feb 20 '07 #5
NeoPa
32,569 Recognized Expert Moderator MVP
Very pleased to hear that Simon.
It's good that Rabbit's first Tutorial has reaped dividends even before it's official release :)
Feb 20 '07 #6

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

Similar topics

8
2887
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time it took to go to a record was very slow. The go to mechanism was a box that the user typed the index value into a combo box, with very simple code attached: with me.RecordsetClone .FindFirst " = " & me.cboGoTo If Not .NoMatch Then Me.Bookmark...
2
2235
by: misschristalee | last post by:
I'm having a brain blockage day.... Scenario: Search Form with 6 text boxes Query has same six fields Each has this IIF: IIf(IsNull(!!),"",!!) with each dictating the correct text box of course. SQL dictates... If text box 1 isNull do nothing or do this OR if text
1
1873
by: dskillingstad | last post by:
Would appreciate any help I could get I have an unbound search form with various text boxes on it for searching my database. I would like to have a combo box on the search form where the source is a field in the table I'm trying to search. The form works great except for the combo box. I pull the data from my table (storing the value rather than the ID), but once I hit my search button, no records are found. This field in my table is...
1
1855
by: Frustrated Developer via DotNetMonster.com | last post by:
I have developed a form that would allow the user to load and search a database several ways, by data range using two combo boxes, by specific number entered in a text box or all database entries. I'm able to use the combo box selection method multiple times with no problem However, when I try to type in a specific drawing number in the txtDrawingNum.text field and click btnLoad I get the same dataset that I previously had from the combo...
2
7248
by: Homey! | last post by:
Hello all I am new to Access. I have imported data from an old FoxPro 2.x database. This is probably the most basic function but I cant get a search box to work. I need to search for company name and cant figure it out in access. Tony (homey)
4
1909
by: visionstate | last post by:
Hi there, I'm fairly new to access and the way it works and I have been building a relatively simple database. It is basically a database where staff members can search for what training they (or others) have completed by staff name, staff group or training name. I created this using a form which had 2 text boxes and a combo box. These were used to search a query and the results were displayed in a sub form within the main form. The...
4
1754
by: DavidB | last post by:
OK folks I am having a serious brain fart here and can't get the code to do what I really want done. I have a form that has a multi-table query as its data source. The data is dsplayed on the form as a series of text boxes and combo boxes. I want to have a button that when clicked will search the previous control (as long as it is one of the text boxes or combo boxes that contain data) for the text the user requests. The search should...
3
1825
by: robertoathome | last post by:
Hello, I successully adapted a search form from a microsoft example into my own db. MS Example I type search parameters in 2 boxes and the results are returned in a new, basic query window. I created: 2 text boxes 1 Command button ( search ) 1 Macro to open the query
1
2906
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a main form (RD Form) with 4 combo boxes (i.e. cbo1, cbo2, etc) and a subdatasheet (the subform...let's call it subInfo) below the combo boxes on the RD Form. I hope this eliminates any confusion of the
0
8691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9180
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8920
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7755
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6536
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2351
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.