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 - tblEquipment
-
equipment ID
-
description
-
brand ID
-
price
-
...
-
-
tblBrand
-
brand ID
-
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. - Private Sub cmdFilter_Click()
-
Dim strWhere As String
-
Dim lngLen As Long
-
-
If Not IsNull(Me.txtFilterDescription) Then
-
strWhere = strWhere & "([Description] = """ & Me.txtFilterDescription & """) AND "
-
End If
-
-
If Not IsNull(Me.cboFilterBrand) Then
-
strWhere = strWhere & "([Brand] = " & Me.cboFilterBrand & ") AND "
-
End If
-
-
lngLen = Len(strWhere) - 5
-
If lngLen <= 0 Then
-
MsgBox "No criteria", vbInformation, "Nothing to do."
-
Else
-
strWhere = Left$(strWhere, lngLen)
-
-
Me.Filter = strWhere
-
Me.FilterOn = True
-
End If
-
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
5 1883
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
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 :)
OK it's working now
thanks a lot
Simon
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 :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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
|
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...
|
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...
|
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)
| |
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...
|
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...
|
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
|
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
|
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...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |