• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

need to display only the employee company products when selected a employee

Hello  i have an  order form in vb 2005 linked from ms access 2003.Needed to when select an employee from a textbox  to provide only the employee products can be done these?

If needed more information pls ask me
0
demoniumz
Asked:
demoniumz
  • 10
  • 9
1 Solution
 
DhaestCommented:
So actually you want to select an employee-id and than query the database for the products...
In what kind of control do you want to show the data ?
Can you show the layout of your tables ...

These articles can help you also on your way:
My First Access Database Program. Part 1
http://www.devcity.net/Articles/115/1/my1st_accessdb1.aspx

Working with MS Access Stored Procedures in VB.NET. Part 1
http://www.devcity.net/Articles/18/1/msaccess_sp.aspx
0
 
demoniumzAuthor Commented:
In what kind of control do you want to show the data ?

what are u mean?
0
 
DhaestCommented:
How do you want to display your data ? In a datagrid, textboxes, ... ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
demoniumzAuthor Commented:
in datagrid i want to display it  you want my  access table display?
0
 
demoniumzAuthor Commented:
in datagrid i want to display it but first must choose it from textbox and pass it to  a datagrdiview
0
 
DhaestCommented:
Do you already have some code where you fill your datagrid ?
0
 
demoniumzAuthor Commented:
Yes i have already  here is my code i full the datagrid
  Private Sub Addpr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Addpr.Click
        Dim bsource As BindingSource = Me.OrdersDetailsDataGridView.DataSource
        Dim ds As DataSet = DirectCast(bsource.DataSource, DataSet)
        Dim orderdetailstable As New DataTable
        Dim dr As DataRow = ds.Tables("OrdersDetails").NewRow
        dr("OrderID") = OrderIDTextBox.Text
        dr("ProductID") = Productidcombobox.SelectedValue
        dr("UnitPrice") = Unitpricetextbox.Text
        dr("Quantity") = QuantityTextBox.Text
        dr("productname") = ProductNameTextBox.Text
        dr("Discount") = 0
        dr("Total records") = 0
        dr("Total") = Convert.ToDecimal(Unitpricetextbox.Text.ToString()) * Convert.ToDecimal(QuantityTextBox.Text.ToString())
 
        ds.Tables("OrdersDetails").Rows.Add(dr)
 
        TotalSum()

Open in new window

0
 
DhaestCommented:
If I see it correctly, this is the code for creating a new order !
0
 
DhaestCommented:
You'll need something like the example below

Dim nwindConn As New SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind") 
 
Dim selectCMD As New SqlCommand("SELECT * FROM Customers where Surname like " & SurName.Text & "%", nwindConn) 
 
Dim custDA As New SqlDataAdapter() 
custDA.SelectCommand = selectCMD 
 
nwindConn.Open() 
 
Dim custDS As New DataSet() 
custDA.Fill(custDS, "Customers") 
 
nwindConn.Close() 

Open in new window

0
 
demoniumzAuthor Commented:
i am not using SQL but ms access database
0
 
DhaestCommented:
The priciples are the same as example given
0
 
demoniumzAuthor Commented:
where i must add it?
0
 
DhaestCommented:
When do you want to show your records ? After clicking on a button, after the textbox has changed ?
0
 
demoniumzAuthor Commented:
when a suplier id  combobox selcted then  the product name  textbox to display only the  products that belong to  him/her
0
 
DhaestCommented:
Take a look at the events of the combobox
yourcombo_SelectedIndexChanged
0
 
demoniumzAuthor Commented:
is dificult to me to understand quries cause i am  newone so i cant do it
0
 
DhaestCommented:
If you are new, I would suggest to read some more information about ADO.NET first than (by reading and learnint tutorials, books, ...)

http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c15033
0
 
demoniumzAuthor Commented:
Dim selectCMD As New SqlCommand("SELECT * FROM Customers where Surname like " & SurName.Text & "%", nwindConn)

what is the purpose of this quey just asked
0
 
DhaestCommented:
You need to change it offcourse, into something like this:

select * from YOURTABLE where yourfield = " & yourcombo.text

where
yourtable = the name of the table in which you want to search (fe OrdersDetails)
yourfield = the name of the field where you want to filter on (fe employeeID)
yourcombo = the name of the combobox which holds the id of the employee you selected
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now