hello sir, m using 4 combo boxes,2 option buttons,button. wen option named single type is clicked data grid must show the data i selected in combo boxes,wen all type option button is clicked then grid shows the all rows in access table.but both option buttons shows all rows in grid the code i have used is - Dim rsname1 as recordset
-
Dim conn As Connection
-
Set conn = New Connection
-
conn.Open "provider=Microsoft.jet.OLEdb.4.0;Data Source=C:\Documents and Settings\admin\My Documents\medical.mdb"
-
Set rsname1 = New Recordset
-
rsname1.Open "select * from MASTER order by [PRODUCT NAME]", conn, adOpenDynamic, adLockPessimistic
-
-
-
If Option2.Value = True Then
-
rsname1.Close
-
Set rsname = Nothing
-
rsname1.CursorLocation = adUseClient
-
rsname1.Open "select * from MASTER order by [COMPANY NAME],[PRODUCT NAME],[PRODUCT TYPE],[PRODUCT SIZE]"
-
-
Form3.DataGrid1.DataMember = ""
-
Set Form3.DataGrid1.DataSource = rsname1
-
Form3.DataGrid1.Refresh
-
rsname1.Requery
-
-
ElseIf option1.Value = True Then
-
rsname1.Close
-
Set rsname1 = Nothing
-
rsname1.CursorLocation = adUseClient
-
-
rsname1.Open "select * from MASTER where [COMPANY NAME]='" & Combo1.Text & "' and [PRODUCT NAME]='" & Combo2.Text & "' and [PRODUCT TYPE]='" & Combo3.Text & "' and [PRODUCT SIZE]='" & Combo4.Text & "', conn, adOpenDynamic, adLockPessimistic"
-
-
-
Form3.DataGrid1.DataMember = ""
-
Set Form3.DataGrid1.DataSource = rsname1
-
Form3.DataGrid1.Refresh
-
rsname1.Requery
-
End If
-
End Sub
till now u might understood the problem m facing.actually problem is with option 2 ie single type.after clicking the command button values must appear in grid.
the error msg m getting is object r variable not decalred.please help me sir
thank u
1 5314
till now u might understood the problem m facing.actually problem is with option 2 ie single type.after clicking the command button values must appear in grid.
the error msg m getting is object r variable not decalred.please help me sir
thank u
Hi -
Your problem is rsname. It was declared as rsname1. See font emphasized below.
If Option2.Value = True Then
rsname1.Close
rsname1.CursorL ocation = adUseClient
rsname1.Open "select * from MASTER order by [COMPANY NAME],[PRODUCT NAME],[PRODUCT TYPE],[PRODUCT SIZE]"
Form3.DataGrid1 .DataMember = ""
Set Form3.DataGrid1 .DataSource = rsname1
Form3.DataGrid1 .Refresh
rsname1.Requery
Just change that to
and its good to go.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Peyter |
last post by:
I am trying to populate the standard vb ListBox control with
an adodc control but it is not succeeding. I know that the
adodc control is set up properly because if I connect it to
a DataGrid control it populates. I set DataSource and
DataField properties of the ListBox but when run, nothing
is displayed (whereas, as I said, the DataGrid populates
fine). Is this somekind of VB bug or am I missing something?
|
by: Alpha |
last post by:
Hi,
I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a
listbox that I have binded to a dataset table, "source" which has 3 columns.
I would like to display 2 of those columns, "scode" and "sname", as 1 column
(if not possible then 2 columns will be fine) in the listbox. Can the
listbox display 2 columns information from the dataset and how can I do that?
Also, I set the property of the listbox to selectionmode...
|
by: Jason (Kusanagihk) |
last post by:
To all,
I am writing a C# application; I've a DataGrid to show and edit data;
then I tried to update the updated data by calling ADO_Adapter.update
(ADO_DataSet, "TableName");
But it pop up a DBConcurrencyException!
Anyone get ideas on how to properly use DataGrids and DataSets together
???
|
by: Joe Van Meer |
last post by:
Hi,
Is the datalist meant for one table or can I use it to display information
from 2 different tables? Or should I be looking at a datagrid instead?
I began my code and kinda ran into a snag where my last two columns I am
displaying are ID fields, one for clientid and the other for empid.
What I would really like is to display their actual names instead of the
ids.
|
by: Steven Smith |
last post by:
Hi guys
What I'm trying to do today is display the results from
an SQL query on one table in a Datagrid I'm using the
following code to query the table.
\\\
Try
If txtCustomersIDOrders.Text <> "" Then
| |
by: priyanka.freakout |
last post by:
Hi All,
In my form I have created a dropdown box which is populated with data
from a database on page load and i have also created a dropdwon box and
what i intend on doing is displaying data re;ated to dropdown selection
into a data grid.
I have attached part of the code.
Can someone please help me out on this cos i am really finding it
|
by: Cindy |
last post by:
Hello. For some reason, I am able to "connect" to the Northwind
database whenever I use the wizard; however, when I run the
application, my datagrid does not display. Here are the exact steps I
am taking to try to get this to run:
1)New Project -->ASP.NET Application
2) From the Server Explorer, drag the Northwind Employees table onto
the WebForm1.aspx design view. SqlConnection1 and SqlDataAdapter1 are
created.
3) From the Toolbox,...
|
by: phil67b |
last post by:
Hello everybody,
I have a page rech.php where I'm doing a multi-criteria research Ex.
choose your car model, choose your country.
After validation of my form, on the same page, the lines will be
displayed (I put a max limitation of 500 lines). Ex. list of cars Fiat
to buy in UK.
A clic on a line will bring me to the display page disp.php Ex. I will
clic on the car n° 5 =<a href="disp.php?
|
by: manjeetgrang |
last post by:
in my form i have datagrid and adodc. i set adodc 's porperty and data grid well. all data is displaying well in grid. but i now wan selected data in grid (say for a particular date only) i am doing as on click event of command button
Dim cn as new adodb.connection
dim rs as recordset
cn.open("DSN=northwind") ' where northwind is DSN
set rs =cn.execute("select * from tablename where datefield= ' " & date & " ')
set adodc1.recordset =...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |