Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

showing dbgrid fields

Posted on 1999-07-19
3
Medium Priority
?
186 Views
Last Modified: 2010-04-30
I have an inventory database which has a list of items, such as CPU, Monitor, Keyboard, Mouse, etc. Each of these items have a location, owner, office, item and make field which they are belong to. I would like to be able to Pick out an item, such as CPU and only show the CPU's whose make is Dell. What kind of code would I use that would only display the CPU's that are made by Dell, etc.  
0
Comment
Question by:clckwrkorange
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Expert Comment

by:apratima
ID: 1525927
I assume that you know how to declare a recordset.
To that recordset object you pass the following query,

"SELECT fieldlist FROM tablename WHERE item = """ & control.text & """ and make = """ & Control1.text & """"
0
 

Author Comment

by:clckwrkorange
ID: 1525928
I do not know how to declare a recordset
0
 
LVL 1

Accepted Solution

by:
apratima earned 200 total points
ID: 1525929
If You are using datacontrol Follow the following method

Data1.Databasename = "Give Database name Along with the path"

Data1.RecordSource = "SELECT fieldlist FROM tablename WHERE item = """ & control.text & """ and make = """ & Control1.text & """"

Now Data1 is your recordsource. Whenever you want to access recordset of Data1 you have to type Data1.Recordset and to access field type Data1.Recordset!FieldName

If you are using DAO you will have to Follow following Method,

Dim Db as Database
Dim Rec as Recordset

Set Db = Workspaces(0).OpenDatabase("DatabaseName Along With the Path")

Set Rec = Db.OpenRecordset("SELECT fieldlist FROM tablename WHERE item = """ & control.text & """ and make = """ & Control1.text & """",dbOpenDynaset)

So Rec is your Recordset.

To access any method or field you will have to type For ex. Rec!FieldName or Rec.AddNew.

Now As per your Requirement You create a combo boxes in which you will display the item and Make resp. and select them or create a text boxes and type the item and Make resp.
In Query I have given control.text and control1.text which are nothing but the controls you will be using for item and make. The control is your choice which could be anything which takes input, Rest of the logic is yours.
Unless and untill U will try, you will not get confidence by just typing the code given by others, this is my friendly advice.







"SELECT fieldlist FROM tablename WHERE item = """ & control.text & """ and make = """ & Control1.text & """"

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question