Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

binding multiple tables to datagrid

Status
Not open for further replies.

mongous

Technical User
Jun 18, 2002
116
US
I have a data adapter that pulls two different tables from an Access database:

1. RepData - contains statistical info on cust serv reps
2. Agents - contains names linked by Logid field

If I right click on the Data Adapter and choose 'Preview Data' I can see the appropriate data with the exception of the date ranges (entered by user).

But I cannot get the datagrid to show that info. I have it selecting the right data, if I just pull from the 'RepData' table (thus showing data with LogId).

Once I try to link the 'Agents' table to show names, I get nothing.


Code:
Me.OleDbSelectCommand2.CommandText = "SELECT tblAgents.FirstName, tblAgents.LastName, tblRepData.Logid, tblRepData.Calls, tblRepData.Staffhours, tblRepData.Row_Date, tblRepData.Team, tblAgents.EmpId FROM (tblAgents INNER JOIN tblRepData ON tblAgents.LogId = tblRepData.Logid)"
Me.OleDbSelectCommand2.Connection = Me.cnRrpData
Then of course that is appended when the user makes their Team/Date range choices:

Code:
   Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

        daAgents.SelectCommand.CommandText = daAgents.SelectCommand.CommandText & " Where (tblRepData.Team = '" & lstTeams.SelectedValue.ToString & "') and (Row_Date BETWEEN #" & StartDate.Text & "# and #" & EndDate.Text & "#)"

        daAgents.Fill(DsAgents)
        dgTeamInfo.DataBind()
    End Sub
Can anyone point me in the right direction? Any help appreciated!
 
I suggest you ask this in the Access forum for VBA as it is not a SQL Server question.

Questions about posting. See faq183-874
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top