Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Filter ADODC And Data ComboBox


Hi

I have a Data ComboBox and two ADODC.
In my ComboBox DataSource and DataField connect to one of ADODC , RowSource and ListField to another.
Because I want limit user ,I filter the ADODC that is connected to Combo Rowsource.
But filter don't effect the Data ComboBox . How can I do this ?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Using ADODC, How Do I Filter The DATA Base(.mdb)
i attached my project, please check it out, i cant make it work the way i wanted it.......

what i want my project to do is to search thru the data base(talents.mdb) i created, theres to types of search, 1 is by name and the 2nd is u can search by age, nationality, etc.....
or if i want search by gender, complexion, hair style, etc, w/o typing anything in the text box, onces i have made my search type, it should fillter all the person to my choice of seach and not
show other poeple that is not part of my search........

my problem when i run my project:
example, i didnt type anything in the txtage and txtNationality, and just checked the box male, fair, long hair and filipino, when i click on the cmdSearch command, it shows all the male in my data base.....

i dont know what to do anymore.........

i'm just a newbie...... please help........

Filter An ADODC
Hello,
Just want to know if it is possible to make an SQL Statement on a ADODC.
Suppose that my ADODC already contains a recordset, I want to be able to retrieve results from a query ( i.e. Select * From ADODC.Recordset where Area ='Outdoor' ), without altering the content of the control, only retrieving specific results so that I can update the content of a combobox, for example...

I Cant Use The .filter In My Adodc
when i use the statement:

adodc1.recordset.filter "id like '7'"

the programs returns an error message containing:

"Invalid use of property"

can you give a possible cause of this error...

How To Use Filter In AdoDC
help me please……

I’m writing a program that searches peoples file and filtering the search, and I cant get it work the way I wanted it……..

for example I’m searching for a person whos nationality is French, and filtering it for male, fair complexion and has long hair…….

when I run my program, and then I type the nationality that I want to search, it only filters the French nationality, and then shows up all the complexion, male, female and all types of hair style in my data base…….


my codes goes like this:

Private Sub cmdSearch2_Click()

if txtNationality = “” then
       msgbox “please type nationality.”
       txtNationality.Setfocus
else
      frmSL.adopeople.recordset.find “Nationality=’” & txtNationality & “’”
      frmSL.adopeople.recordset.filter = “Nationality =’” & txtNationality & “’”

      if frmSearchList.adopeople.recordset.eof then
         Msgbox “Ur search in Nationality does not exist in the data base.”
         txtNationality.text = “”
         txtNationality.setfocus
      else
    if chkMale.value = 1 then
     frmSL.adopeople.recordset.find “Male=’” & chkMale & “’”
     frmSL.adopeople.recordset.filter = “Male=’” & chkMale & “’”

     if frmSL.adopeople.recordset.eof then
     Msgbox “no Male in the nationality u search in the data base.”
     txtNationality.text = “”
     txtNationality.setfocus
     else
        frmSL.show vbmodal
     end if
    
if chkFemale.Value = 1 then
     frmSL.adopeople.recordset.find “Female=’” & chkFemale & “’”
     frmSL.adopeople.recordset.filter = “Female=’” & chkFemale & “’”

        if frmSL.adopeople.recordset.eof then
         msgbox “No Female for Nationality search.”
         txtNationality.text = “”
         txtNationality.setfocus
        else
         frmSL.show vbmodal
        end if

    else
            if chkWhite.value = 1 then
     frmSL.adopeople.recordset.find “White=’” & chkWhite & “’”
     frmSL.adopeople.recordset.filter = “White=’” chkWhite & “’”
        
                        if frmSL.adopeolpe.recordset.eof then
         msgbox “No white complexion in nationality search.”
         txtNationality.text = “”
         txtNationality.setfocus

      else
         frmSL.show vbmodal
     end if

     else
          if chkFair.value = 1 then
         frmSL.adopeople.recordset.find “Fair=’” & chkFair & “’”
         frmSL.adopeople.recordser.filter = “Fair=’” & chkFair & “’”

         if frmSL.adopeople.recordset.eof then
         msgbox “No Fair complexion in Nationality search.”
         txtNationality.text = “”
         txtNationality.setfocus

         else
         frmSL.show vbmodal
         end if

        else
         if chkDark.value = 1 then
         frmSL.adopeople.recordset.find "Dark='" & chkDark & "'"


i'll stop at this point of my code.........
i'm using VB6, and my database is MS Access
i'm using adoDC, Microsoft.Jet.OLEDB.4.0

can anyone please help me........ i really don't know what to do anymore.............









Edited by - asianpinoy25 on 6/4/2004 12:35:09 PM

ADODC Filter Help
i write program to read DBF file and use filtering and take to DataGrid1

Adodc2.Refresh
Adodc2.Recordset.Filter = "DATA1 = " & Num.Text
Set DataGrid1.DataSource = Adodc2

all works fine but if record not found i have empty DataGrid1 - how to make that when record not found i have msgbox "record not found" ??

please help and thank you! for past helping

ADODC - Filter Date
Hi ,


I used ADODC control as my recordsource and I am planning to filter a date using it, here's my code:

=================================================
FieldName = "HiredDate"
frmMain.AdoDCFind(3).Recordset.Filter = FieldName &" LIKE #" & txtFilter& "#"
=================================================

HireDate - name of the field
txtFilter - name of the text box where the user inputs the the date


This works fine if the user inputs date in this format mm/dd/yyyy in the txtFilter.Textbox. If they only input a year it doesnt work. I want ADODC to filter records even the user just input a year, day or month. What will I do? Please advise. Thanks in advance!

How To Filter With More Than One Criteria In Adodc??
Dear All,

Hope all are in fine tune.

I wanna ask you "How to filter with more than one criteria in adodc in vb6??"

I used that code, Adodc1.Recordset.Filter = "device_code=" & dv.Text1.Text,
to filter with one criteria and i wanna add onther criteria to this code.

Thx u all.
Best Regards,
Shimaa

ADODC / Datagrid Filter...
Hi, Im using an ADODC control to scroll and save data to an MS Access 2000 DB, i also have a datagrid connected to the ADO which displays the information as i update it.

I would like to add a filter function to the datagrid so that i can filter by the date expected and see only those items which have the date i specify.

Ive tried several different ways of doing this but i never seem to be able to get it to work.

Adodc1.RecordSource = "Select * From Fasttrack Where DateDue = txtdatefilter.text"

Adodc1.Refresh

This does nothing except give me an error message Syntax Error in FROM Clause. Then when i debug it highlights Adodc1.Refresh as the problem. When i take the refresh out it doesnt do anything at all...

Any help will be appreciated

ADODC Datalist Filter
I have a datalist on a form that connect to an Access DB.  I would like to have the list only show thing at aply to the user who signs in. I have a start page where user select their group and enter a password then it takes them to and option page.  On the option page I only what the user to see in the list thing that they are using.  I already have a text box that is not visible but contain the value to filter by.  So how can I filter a datalist box???

What doesn't kill you makes you stronger.

Slow Adodc Filter With DSN
i have data base file .dbf with 6000 of records and write program to search record

Adodc2.ConnectionString = "FILE NAME=C:Datadata.DSN"
Adodc2.RecordSource = "data"
Adodc2.Refresh
Adodc2.Recordset.Filter = "NR_ADRESS= " & NR

and the time of searching record ist about 30 seconds... please give me a full code to repleace this with SQL because this is faster method (maybe?)

please help

Adodc Filter With 2 Fields.txt
i have 1 text field
a.txt
and connection to .dbf

Adodc3.ConnectionString = "FILE NAME=C:DataData.DSN"
Adodc3.RecordSource = "Data"
Adodc3.Refresh
Adodc3.Recordset.Filter = "TYP = " & a.txt
If Adodc3.Recordset.EOF = True And Adodc3.Recordset.BOF = True Then
MsgBox "Brak szukanego surowca w magazynie"
Else
    Set DataGrid1.DataSource = Adodc3
    End If
End If

ok all works fine - if field "TYP" = a.txt then i seeing all on datagrid but if i wanna searching filter with 2 fields (2 criterias)
a.txt and b.txt
so how to make this ??? please help





Edited by - Speechless on 7/30/2003 1:45:33 PM

Problem With Using ADODC Filter In Subroutine
I'm trying to filter database results using an ADODC Control, Combobox and a Grid.

Code:
Dim cn As ADODB.Connection
Dim adoRecordset As ADODB.Recordset
Dim sqlQuery As String
Dim connectString As String


Private Sub Form_Load()
cmbFilter.AddItem "Please Choose..."
cmbFilter.AddItem "A Week Ago"
cmbFilter.AddItem "A Month Ago"
cmbFilter.AddItem "A Year Ago"
cmbFilter.Text = "Please Choose..."


connectString = "Provider=SQLOLEDB.1;" & _
"Data Source=" & "VM-DEV1-DB1" & _
";Initial Catalog=" & "SSDS" & _
";Integrated Security=SSPI" & _
";Persist Security Info=False;Trusted_Connection=Yes"
Set cn = New ADODB.Connection
cn.Open connectString
sqlQuery = "select * from ApplicantListView"

' ***************** ADODC Controls **************
With adoFilter
.ConnectionString = cn.ConnectionString
.RecordSource = sqlQuery
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.CommandType = adCmdText
.Refresh
End With

' *************** ADODB Recordset **************
' Set adoRecordset = New ADODB.Recordset
' If (adoRecordset.State = adStateOpen) Then
' adoRecordset.Close
' End If
' adoRecordset.Open sqlQuery, cn, adOpenDynamic, adLockOptimistic, adCmdText

Set grdFilter.DataSource = adoFilter
grdFilter.Refresh
End Sub


Private Sub cmbFilter_Change()
Dim filterDate As Date

sqlQuery = "select * from ApplicantListView "

Select Case cmbFilter.Text
Case "A Week Ago"
filterDate = DateAdd("ww", -1, Now)
Case "A Month Ago"
filterDate = DateAdd("ww", -1, Now)
Case "A Year Ago"
filterDate = DateAdd("yyyy", -1, Now)
End Select

Me.adoFilter.Recordset.Filter = "[Check Date] <= '" & filterDate & "'"
End Sub

When I run the program I receive this error message 'Object variable or With block variable not set' at the highlighted filter command. I've gotten the same error message with both ADO Recordsets and ADODC. Can anybody work out what's going on?

Slow Searching Filter With ADODC Connection
i have data base file .dbf with 6000 of records and write program to search record

Adodc2.ConnectionString = "FILE NAME=C:Datadata.DSN"
Adodc2.RecordSource = "data"
Adodc2.Refresh
Adodc2.Recordset.Filter = "NR_ADRESS= " & NR

and the time of searching record ist about 30 seconds... why so long ?? is there another method ?????

please help



Edited by - Speechless on 7/30/2003 12:59:43 PM

Adodc Filter For Date In Text Type
Dear gurus,
Can anybody be of my help?
I use msaccess 2000,adodc1,mshflexgrid1 in vb6 enterprise edition
in the database named db1 I have a 2 fields: dts & names(both text type). I show the data in mshflexgrid.I didnot make the dts field date/time type because in the flexgrid the date shows as 2006-02-20. But I want to show as 20/02/06. When I use the filter, the date query is not executed. I have 2 textboxes in the form showing the period between 2 dates.
I use like:
command1_click()
adodc1.recordset.filter="dts=>'" & text1 & "' and dts=<'" & text2 & "'"
end sub

pkb_pkb


pkb_pkb

(VB6, Access DB Via ADODC Control) - Syntax For Performing WHERE Filter Before RIGHT JOIN?
I'll try and explain the background before launching into the SQL, since at the very least that'll refresh my mind somewhat.

I've got a table containing records of boats on a canal going upstream or downstream, along with the date, time and location (site) at which they were recorded. I'm trying to plot a 'daily totals' graph for the whole year; since there may be days when no boats are recorded I am using a second table containing the entire range of dates from 01/01/04 to 31/12/04 to fill in the gaps; I use a RIGHT JOIN statement to combine the two tables, getting in return (hopefully!) a table of every day of the year and the appropriate data (UP, DOWN and TOTAL [ie UP + DOWN]), or 0s where no boats were recorded.

This works like a charm, until I add a WHERE SITE = 'Site 1' statement to narrow the data down to boats recorded at the site I'm concerned with. This operation needs to take place before the RIGHT JOIN, otherwise I end up losing the dates with no records (ie undoing all that the RIGHT JOIN just did!)

Here's the query:
Code:
SELECT Format([System.Date], 'dd/mm/yy')    AS DATES,
COUNT(IIf([Direction]='Up',[Direction],Null))     AS UP,
COUNT(IIf([Direction]='Down',[Direction],Null))     AS DOWN,
COUNT(IIf([Direction]<>'',[Direction],Null))     AS TOTAL
    From Table1
    WHERE ( Site = 'Site 1' )

RIGHT JOIN System ON Format(System.Date, 'dd/mm/yy')=Format(Table1.Date, 'dd/mm/yy')
    GROUP BY Format([System.Date], 'dd/mm/yy'),Format([System.Date], 'dd'), Format([System.Date], 'mm'), Format([System.Date], 'yy')
    ORDER BY Format([System.Date], 'yy'), Format([System.Date], 'mm'), Format([System.Date], 'dd')


And the error the Adodc1 control pops up with:

Code:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '( Site = 'Site 1') RIGHT JOIN System ON Format(System.Date, 'dd/mm/yy')=Format(Table1.Date,'dd/mm/yy')'.


I expect it's one of those stupid errors I should be kicking myself over; the 'missing operator' should be a good clue, but I don't have any idea what it could be. Too many hours staring at a screen this week!

Any help would be gratefully received (understatement!)



Edited by - staylo on 10/28/2004 4:51:45 PM

Problem With Adodc.recordset.filter Property And Flashing The Result In MSHFlexgrid
The view in the SQLserver2000 is as follows

CREATE VIEW dbo.VW_PURCHASE
AS
SELECT dbo.Trn_Purchase.Lot_no,
dbo.Trn_Purchase.p_code,
dbo.Mst_Cr_Party.Name as Party_name,
dbo.Trn_Purchase.Inv_date,
dbo.Trn_Purchase.Inv_no,
dbo.Trn_Purchase.Rec_unit,
dbo.Mst_Raw_mat.Unit,
dbo.Mst_Raw_mat.Name as Material
FROM dbo.Trn_Purchase
INNER JOIN dbo.Mst_Cr_Party
ON dbo.Trn_Purchase.p_code = dbo.Mst_Cr_Party.P_code
INNER JOIN dbo.Mst_Raw_mat
ON dbo.Trn_Purchase.R_item_cd = dbo.Mst_Raw_mat.R_item_cd



I have used the Adodc control to display this view in the MSHFlexgrid con trol. It is working well. The problem arises when I need to filter the adodc recordset. The criteria is date range and invoice_nos. The code I generated is as given below.



Dim rec_adb As New ADODB.Recordset
Dim recst As New ADODB.Recordset

Private Sub Combo1_Click()
Dim nm As Integer

With Adodc1
.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=workflow;Data Source=SYS1"
.CommandType = adCmdTable
.CursorType = adOpenStatic
.RecordSource = "vw_purchase"
End With

'nm = Adodc1.Recordset.RecordCount /error ‘ recordset not open’
' MsgBox nm

view_pur_grd.Clear

Set rec_adb = Adodc1.Recordset
st = Trim(Combo1.Text)
Set recst = FilterField(rec_adb, "inv_no", st)

' nm = recst.RecordCount /error ‘recordset not open’
' MsgBox nm

'Set Adodc1.Recordset.Filter = "inv_no" & "= '" & Combo1.Text & "'"
Set Adodc1.Recordset = recst /error ‘object variable or with block not set’

Adodc1.Refresh
Set view_pur_grd.DataSource = Adodc1
view_pur_grd.Redraw = True
End sub


Public Function FilterField(rstTemp As ADODB.Recordset, _
strField As String, strFilter As String) As ADODB.Recordset

' Set a filter on the specified Recordset object and then
' Open a new Recordset object.
rstTemp.Filter = strField & " = '" & strFilter & "'"
Set FilterField = rstTemp

End Function



Please help.

Adodc To Combobox
How can I connect my database using adodc to combobox? Please help me I just a newbie in Visual Basic.

Combobox Filter
I have this Code everytime when key_press generate querry. I need to set fillter for dublicate Items in this Combobox. Any suggestions ?


Code:
Private Sub cmbSearch_Change()
Dim rs As ADODB.Recordset
Dim sSQL As String
Dim sProvider As String
Dim FillCombo As Boolean
Dim FildName As String
FildName = "Cust_AcSeekName"
sProvider = "Provider=SQLOLEDB.1;Password=***;Persist Security Info=True;User ID=sa;Initial Catalog=Mireva;Data Source=10.1.1.19"
sSQL = "Select * from customers Where Cust_AcSeekName Like '" & cmbSearch.Text & "%'"

Set rs = New Recordset
rs.Open sSQL, sProvider, adOpenKeyset, adLockReadOnly, adCmdText

FillCombo = True
Do While Not rs.EOF
cmbSearch.AddItem rs(FildName)
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
FillCombo = False

Combobox Filter
Hi,

Is there any way to create filter to dbCombo box, which is binded to an Access db thru datacontroller using DAO?
I need to get rid of " " -values.

Filter With Combobox....
I use the FUNCTION GetUniqueTipoSosps to fill combobox with filter but not workl correct!!!
Example:
when i select item from FIL./GRUPPO (combobox2), CODICE SOSP. combobox1, is filled with all unique value related in a filter with key in combobox2...
My problem is ...
When combobox1 change i want toi fill combobox3 with dates relatyed value in combobox1 and combobox2 but not work!!!!!!!

Example:

ComboBox2=4507
ComboBox21 =250008059999

for me the combobox3 with the condition in combobox1 and combobox2 is 03/02/2007

but i have:
29/01/2007
30/01/2007
02/02/2007
03/02/2007
 

for test use the simple filter in sheet with the param in combobox1(coloumn D) and combobox2(column L) and see the value with this param in column J is 03/02/2007 and not the list of dates:

29/01/2007
30/01/2007
02/02/2007
03/02/2007
 





Edited by - luca91 on 1/31/2007 1:32:05 PM

Still On Filter Combobox
I want to filtre and show in combobox1 and combobox2 only the value refred...(without dupes)
Example:
Cbox2=4500 show in cbox1 146900090000 and 299900000000
Cbox2=4580 show in cbox1 101604870001, 101604870003,101604870004....203700020000
I have maked variuos test but not good solution found...
Note: in initialize userform to the default are present in cbox1 and cbox2 with the refred data about 4500

Combobox To Be Used To Auto Filter
i have a form which has 2 combo boxes. 1 contains the header. The second is where i need help. It contains values in that column which serve as the criteria to sort an excel sheet. (similar to the one which appears on the header cell when auto filtering). I just cant seem to get only the unique values in the column. Any help?


Once found, I can auto filter using:
wrkst.range(combobox1.seltext).AutoFilter 2, combobox2.seltext, , , True

How To Use Combobox To Filter Record
hi please help,how to use combobox filter the record from combobox + listview selected item?currently i want use combobox and Listview selected item to filter the TimeFrom and Timein .Timefrom and Timein is combobox.

for example:
category of OT working day =Normal , Shift=Normal =TimeFrom:8:00am,9:00am,10:00 ,TimeTO:3:00PM,4:00pm,5:00pm
category of OT working day =PH ,Shift=A
=TimeFrom:7:00am,8:00am, ,TimeTO:5:00pm,7:00pm

where should i write to code to??
thanks for help.

Combobox In TDBGrid's Filter Bar?
Hi,

I'm using a Component One True DBGrid (8.0) to show data (from a recordset) for the user. I'm also using the filter bar so that the user can filter each column. Now I want the user to be able to choose the value of a column's filter from a combobox.
Is it possible to use a combobox in the filter field of a grid's filter bar? And in that case, how?

Thanx in advance!

/Mia

Use Combobox To Filter Record
hi please help,how to use combobox filter the record from combobox + listview selected item?currently i want use combobox and Listview selected item to filter the TimeFrom and Timein .Timefrom and Timein is combobox.

for example:
category of OT working day =Normal , Shift=Normal =TimeFrom:8:00am,9:00am,10:00 ,TimeTO:3:00PM,4:00pm,5:00pm
category of OT working day =PH ,Shift=A
=TimeFrom:7:00am,8:00am, ,TimeTO:5:00pm,7:00pm

where should i write to code to??
thanks for help.



Edited by - monchichi on 1/20/2008 10:13:18 PM

How To Use Combobox To Filter Record
hi please help,how to use combobox filter the record from combobox + listview selected item?currently i want use combobox and Listview selected item to filter the TimeFrom and Timein .Timefrom and Timein is combobox.

for example:
category of OT working day =Normal , Shift=Normal =TimeFrom:8:00am,9:00am,10:00 ,TimeTO:3:00PM,4:00pm,5:00pm
category of OT working day =PH ,Shift=A
=TimeFrom:7:00am,8:00am, ,TimeTO:5:00pm,7:00pm

where should i write to code to??
thanks for help.

Multiple Filter With Combobox Or Checkbox
I want to do the following,
I have a database with a field that has the AREA letter. Exsaple P from Process. Each area can have many items.
When I open the form it lists me all the items from all areas in a listview. Now what I want to do is to change add a filter to my SQL statement acording to my combobox or checkbox.
Lets start easy, I have only one combobox and want to filter the selected area. Dont forget if I have not selected something, it has to show all items.

Thanks

Please Help, ADODC Not Working Propoerly With ComboBox On Server
Hello Everyone,

I would first like to thank you for taking the time to read my help request here. I have built some software for a company, it is really simple, it connects to a database "Access 2000" and the user can add/edit/delete Customer Information as well as search the customer information. The search function works like so:

The user chooses one of the many customers names by clicking on the DataComboBox that is in the application, once they choose a name, automatically all the customer information is displayed on the form.

The program works perfectly on my computer as the developer...

The Problem

The company would like 10+ people to be able to add/edit/delete/search customer information, this can happen because they have their own server in house, and I have installed the program on the server as well as the needed documents.

When the user wants to add/edit/delete the program works just find, the user can move and navigate through the attached database programmed by rs.MoveFirst and rs.MoveLast

However, when the user goes to search, my datacombobox control does not connect properly to the ADODC1.

At first when I click on the form it comes up with an error looking for the ACTIVE X control MSADODC.OCX I ahve installed this, then it looks for MSDATLST.OCX

I have an understanding that the problem probably lies in referencing and locating the proper controls on other computers. I just don't know how to go about connecting the controls to my program on other computers.

Please remember I can run the program off the server on my 'developer' computer and it works just perfectly, however when someone else runs the program on another computer it does not connect.

Please advise

Thank you for your time.

Setting Recordset Filter On ComboBox Selection
I'm using VB6 with ADO Recordsets against an SQL Server 7 database.
I'm trying to filter a recordset but I'm stuck.
I have two comboboxes on a form - cboAgencyName and cboProgramNames.
The resultsets are: cboAgencyNames:
SELECT * FROM Agency ORDER BY Agency
and cboProgramNames: SELECT * FROM Programs ORDER BY Program
----
When the user selects a value from cboAgencyName, a textbox to the left of the combo is filled with the AgencyCode of that chosen Agency.
I'd like to populate the cboProgramNames with ONLY the Programs that apply to that Agency chosen in the combobox.
I do have a linking field, the textbox AgencyCode, (which is in both the Agency table and in the Programs table), which I can use in a WHERE clause to filter the recordset of the cboProgramNames combobox.
I just don't know how to set the filter.
------
Also, I'm confused about which Event of the combobox to use:
I've tried LostFocus, Click, and the Change Event.
Can you tell me which is the best Event I can use for this case:
When a user chooses an Agency in the top combobox, I'd like to filter that choice and have the bottom combobox filled with a list of Programs that is updated on that particular Agency.

Thanks in Advance
John
 
 

Binding Adodc To Itemdata Of A Manually Filled Combobox
Hello,

I have a combobox which i fill manually with the following code

Code:
    Dim rs As New ADODB.Recordset
    dim SQL as String

    SQL = "SELECT DISTINCT id, CatNaamEN FROM " & tblProductenCategorie & " Order by CatNaamEN ASC"
   
    rs.Open SQL, dbConn, adOpenStatic, adLockReadOnly
         Do Until rs.EOF
            cbo.AddItem rs.fields(1) 'text
            cbo.ItemData(cbo.NewIndex) = rs.fields(0) 'id
            rs.MoveNext
        Loop
    rs.Close
End Function


I also bind the combobox with a adodc control with the following code
Code:
    me.cbosoort.dataSource=me.adoOverzicht
    me.cbosoort.DataField = adoOverzicht.Recordset.fields("SubCategorieId").Name
 

This works, but i when the user selects a value from the combobox the text is returned to the bound adodc.
I now want to bind the control to the itemdata of the combobox and not the text.


isn't there something like me.cbosoort.Itemdata.dataField = ...

Thanks in advance

ADODC Filter &amp; &"LIKE &" Trouble
I try this code .If I use LIKE for filtering my database ,error 3001 (wrong type argument) is showed
Dim mystring As String
mystring = "*pub"
Adodc1.Recordset.Filter = "name LIKE '" & mystring & "'"

If I use '= ' instead of 'like' no problem is seen

If I don't use this way ,how Can I do that ?



Edited by - Hamid1345 on 11/28/2003 1:14:56 PM

Data Report, Filter Data Enviroment With User Input
Hi,
Im using VB6 and have a data report with a data enviroment. The data enviroment runs off a query in my access db which combines the adviser with there rotas. The results of the query are a long list of everyone in the db and there rota which is fine. In my interfcae ive got a form called frmselectrota which has a text box, i need the user to be able to enter there ext number (unique) and then when a button is clicked the datareport will be filtered to show only that person rotas. Ive been looking around and i cant seem to find a simple piece of code to filter the data enviroment... as the data enviroment runs frtom a access query there is no vb side sql...
any ideas greatly appriciated!!

Filtering Data With SQL Using A ADODC Data Source
I have a small VB database, where I would like the user to have the option to filter the database records by a given letter or a group of letters (the data records are being viewed through a msflexgrid if that makes any difference and not through normal text boxes). I have tried several times to construct an SQL statement to include the "LIKE" option, but failed.
Can anybody help me please or point me in the right direction where I can get good examples of SQL statements using VB.

Once again --- THANKS-----

Data Grid And ADODC's Data Source
Hi

I have 4 SQL tables and 4 ADODC's (one for each table) and also have 1 DataGrid
How do I change the datagrid's DataSource without adding a data grid for each sql table ?

If I change the DataSource, DataGrid's column caption, data Field, col width, col visible or not, will also
change..... how do I do that?

this is what I have for ONE Sql table:
       
Private Sub Text4_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

    If IsNumeric(Text4.Text) = False Then
         MsgBox "Week number?"
      
    Else
             Adodc1.RecordSource = "select * from " & pSqlTbl & " where DATE > 0 AND weeknum = " & Text4.Text & " and year = " & Text3.Text & ""
             
                If Not Adodc1.Recordset.EOF Then
                    Adodc1.Refresh
                    DataGrid1.Refresh
                    DataGrid1.Visible = True
                End If
                 
                 
                 
     
    End If

End If


Any ideas


Thank you

OF

How Can I Filter Data Wich Not In Data Base
please help me how to filter my data
i have student data like student 1 until student 20
and other data (data 2 ) is student who take 1 study like math
so if the student whi dont take math do not appear int data 2 right?
how can i list student who take math? how i type the cod e to do that?

ADODC Vs Data
Can anyone tell me what is the difference between ADODC and the standard Data scrolls? I have an application where I want to add new records. Using the standard Data it is fine because I can just set all the text boxes to have a specific DataSource and DataField and then just do Data1.AddNew.

When I try this with an ADODC I cant do this. I assume it will be something like:

adodc("FIELD1") = Text1.Text
adodc("FIELD2") = Text2.Text
adodc.AddNew

but I cant seem to figure this out. Please help!

Mark

How To Filter Data Using SQL In EVB?
Hi, pls help. I wan to display data on grid from database only with the date of current present date. I change the SQL statements as below but not working. Please help. Any ideas?
Hi, I'm Ivan. Could you please help with my eVB project? I understand that you had some experiences on eVB. I want to filter the data from database. The data that I want to display is just the records of current present day. I tried to change the SQL but it said something about overflow of data. The code is at below, please help. A million thanks

Dim RS As ADOCE.Recordset
Dim SQL As String
Dim i As Integer
Dim dd As Date

Set RS = CreateObject("ADOCE.Recordset.3.1")
SQL = "SELECT * FROM Blood_Tracking WHERE Date = dd"
'Create SELECT statement to return all fields

RS.Open SQL, "My Documentsdiabetes.cdb"
For i = 1 To gd.Rows 'Remove existing data from Grid
gd.RemoveItem 0
Next
gd.AddItem "Date" & vbTab & _
"Time" & vbTab & _
"Mg/dL" & vbTab & _
"Shortinsulin" & vbTab & _
"Longinsulin" & vbTab & _
"CriRange"
While Not RS.EOF
gd.AddItem RS("Date") & vbTab & _
RS("Time") & vbTab & _
RS("Mg/dL") & vbTab & _
RS("Shortinsulin") & vbTab & _
RS("Longinsulin") & vbTab & _
RS("CriRange")
RS.MoveNext
Wend
RS.Close
Set RS = Nothing

End Sub

Changing From Data To Adodc
hi im using this code:

Code:
Data1.Recordset.MoveLast
Data1.Recordset.AddNew
Data1.Recordset![PC ID] = txtPCID.Text
to add new records to a database. im using a data control but i want to switch to an ADO. if the the ado was called adodc1 what would the syntax be?
Thanks!

ADODC - ADO Data Controls
I am using
rs.Open "Select * From Customer", conn, adOpenKeyset, adLockOptimistic, adCmdTable

to create a recordset from my table. Now I have an old Form with over 200 bound controls bound to an ADO Data Contol with a number of ways to manipulate the recordset and search it.

how do I now use this rs.open statement with the ADODC.

Cause when I get like 400+ records in this Access Database it will take to long to navigate the whole recordset when I can use a simple select statment to filter any unneeded data and navigate this new recordset a lot quicker



Mr Tremor

Adodc The Same As Data Control?
hello,

I've noticed that a lot of people are having trouble with the data object DatabaseName property etc. I am using Access 2000 and I was wondering if the adodc connection works the same as the other data control but is more suitable when using access 2000...because I'm having the same problem

Can someone explain if I can use the adodc in the same way...

Also when I try and use app.path it doesn't recognise it???

thanks

Data Or Adodc Control?
Is it Better to use a Data Control or a Adodc Control for a database Access Program?

Data Control And ADODC
i was just wonderin wat are the differents between data control and adodc..i know both can be used to interact with the database..i dont seem to see any differences between these two database object

thankx in advance

ADODC Deleting Data?
Hello,
I have an ADODC control on a form powering a datagrid control. It seems that if I set the ADODC's ConnectionString and RecordSource properties at design-time, the data is retrieved without issue regardless of anything at run-time. However, when I exclude the ConnectionString and RecordSource data at design-time and set them one the form_load event (remembering to refresh the ADODC object), the control will delete the value in cell 1,1. I can set the properties at run time, but if they're set at design time that cell is deleted. I think this may be a glitch with the control, but I'm not sure if there's any other explanation.

Thanks ahead of time

ADODC And Data Grid
I have a form with an ADO Data control and a Data Grid 6.0 (OLEDB) (SP5) on it.

On the form that calls this form, I set my connections and SQL. The form with the Data Grid on loads and the Grid is populated with data except for the first cell on the grid which is empty?

I haven't put any extra code in to change the contents of this cell, so when do I get a "You tried to assign a Null value to a variable that is not a Variant data type."

Anyone - any ideas?

Adodc Data Control
does anyone know how you can access a specific field in a specific table in an access database which is linked to an Adodc data control?

thanks, PJ

ADODC Data Control
Well here is the Deal. I am working on the following query

SELECT creditanddebit.date, creditanddebit.debit, creditanddebit.credit, creditanddebit.accountbalance FROM creditanddebit, internalaccounts WHERE creditanddebit.account= internalaccounts.accountnumber AND internalaccounts.accountdesc='Cash in Transit'


Well everything workd fine .. But I want to query it on a variable insted of the Actual field name .. 'Cash in Transit'

If i replace 'Cash in Transit' with a variable name with the same string stored in it .. It doesnt do anything

any suggestions why ?

Adodc For Data Report???
Is it possible for VB 6.0 to use adodc in making data report ??? Sorry if I asked such a noob question because I just started to study VB... Thanks please reply

ADODC And Data Environment
I would like to know how to refresh a recordset. I have a data environment and a Connection that was used to print reports from the database(sql2000).

Private Sub Command1_Click()
Customer.Recordset.AddNew
End Sub

was used before the adaptation of data environment and connection but now I'm unable to add records, update, del and refresh with the same coding! Does any one know any alternative I can use?

Retrieve Data Using Adodc
hi,
i m using adodc in vb6. i want to retrieve all records which are exits in database. i.e i want to retrieve all records which have 12 no IDs.i m also using Dategrid in the form. if there are 3 records so Datagrid must show 3 records.so plz help me in this regard as soon as possible. if something wrong in the code so plz correct it. i will very thankful to you.my code is bloew.

Private Sub Command6_Click()
Adodc1.Recordset.Find "pdate=" & "'" & Text5.Text & "'", 0, adSearchForward, adBookmarkCurrent
Set DataGrid1.DataSource = Adodc1
If Text5.Text <> Adodc1.Recordset!pdate Then
MsgBox "Account Number does not Exist", vbInformation, "Account Details"
Text1.SetFocus
Exit Sub
Else
Text1.Text = Adodc1.Recordset!aid
Text2.Text = Adodc1.Recordset!fname
Text3.Text = Adodc1.Recordset!addr
Text4.Text = Adodc1.Recordset!ph
End If
End Sub

Copyright © 2005-08 www.BigResource.com, All rights reserved