locked
using visaul studio 2010 to filter though an access database and only show values marked as yes RRS feed

  • Question

  • Hi

    I am doing a project and in this project I have a textbox that is auto filled from access and the only Values this will show are "Auditor, Tech or Engineer" and I want a combo box to read this value and filter through the access data base and to filter through a field called "Tech, Aud or Eng" depending on the textbox. The fields are Yes or no boxes and I want the combo box to only show rows that say "yes" to show Another field called "nme" to be shown in the combo. 

    Don't know really where to start with any of the code as I'm new. Is anyone able to support with the code for this?

    Many thanks

    Thursday, September 17, 2020 10:22 AM

All replies

  • Hello,

    Since there are multiple methods for loading a DataGridView from a Microsoft Access database we need to know how the DataGridView is loaded. You can show via posting your code using the code button.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, September 17, 2020 10:32 AM
  • Hi,

    I am not using datagridview just need a text box value to search a access data base and to find a field in access that the textbox text mates and if yes for it to add another field row called "nme" and add them to a combobox. 

    Thank you for your time

    Thursday, September 17, 2020 11:23 AM
  • Hi,

    I am not using datagridview just need a text box value to search a access data base and to find a field in access that the textbox text mates and if yes for it to add another field row called "nme" and add them to a combobox. 

    Thank you for your time

    Well that all fine that you are not using a DataGridView but how are you connecting to Microsoft Access? You must have tried something so far so show us and we can then assist but not until we see what you have tried so far.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, September 17, 2020 11:40 AM
  •  Dim con As New OleDb.OleDbConnection
    
            Dim strsql As String
    
    
            Dim myreader As OleDbDataReader
    
    
    
            con.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Y:\Training Matrix\Training Matrix Project\Training Matrix.2\bin\Debug\Training matrix database2.accdb")
    
            con.Open()
    
            strsql = " SELECT wsx, edc, rfv, tgb, ujm FROM qaz where wsx = '" & TextBox4.Text & "' "
    
            Dim cmd As New OleDb.OleDbCommand(strsql, con)
    
            myreader = cmd.ExecuteReader
    
            If TextBox4.Text = "Auditor" Then
                ComboBox2.DataSource = " SELECT Name FROM Criteria where Aud = Yes"
            End If
        End Sub

    Wednesday, September 23, 2020 8:18 AM
  • Hi lolbird1212,

    Thanks for your feedback.

    Based on your code, I have a question to confirm with you.

    After selecting related data from table 'qaz' and 'Criteria', what kind of data do you want to add to the combobox control?

    Please provide more details. It will help us analzye your problem and make a test.

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 24, 2020 6:13 AM