I am trying to create a form in VB6 that allows the user to select different Names that can vary each time run, and create a report with only the relevant records atached to the selected names.
This is the sql statement that is used in the Data Environment in vb.
Code:SELECT DriverID, DriverFirstName, DriverLastName, StartDate, LeaveDate, WeekNumber, TotalCash, TotalAccount, FullName FROM WeeklyTotals WHERE (FullName = ?) AND (WeekNumber = ?) And (Year = ?)
And this is the code that i have created in vb:
This is the button clicked when the user has selected a name from a combo box:
VB Code:
Private Sub BtnAdd_Click() If Not CmbDrivers.Text = "" Then If sqlDrivers = "" Then sqlDrivers = Chr(39) & CmbDrivers.Text & Chr(39) Else sqlDrivers = sqlDrivers & " OR FullName = " & Chr(39) & CmbDrivers.Text & Chr(39) End If LstDrivers.AddItem (CmbDrivers.Text) CmbDrivers.RemoveItem CmbDrivers.ListIndex Else MsgBox "Please Select Driver", vbOKOnly, "Error" End If End Sub
This button is clicked on completeion:
VB Code:
Private Sub BtnComplete_Click() If DeDailyTakings.CnWeekly.State = adStateOpen Then DeDailyTakings.CnWeekly.Close End If Dim CalVal As Integer Dim CalYear As Integer CalVal = (Format(Calendar.Value, "ww", vbWednesday)) CalYear = Calendar.Year RptSelectWeekly.Sections("Section2").Controls("LblWeeknumber").Caption = (Format(Calendar.Value, "ww", vbWednesday)) DeSelectWeekly.QrySelectWeekly sqlDrivers, CalVal, CalYear Unload Me FrmMainMenu.Show RptSelectWeekly.Show End Sub
When I click the complete button to finalize the report appears but it is blank.
Any ideas what the problem is?
Thankyouplease.
Michael


Reply With Quote