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:
  1. Private Sub BtnAdd_Click()
  2.  
  3. If Not CmbDrivers.Text = "" Then
  4.  
  5. If sqlDrivers = "" Then
  6. sqlDrivers = Chr(39) & CmbDrivers.Text & Chr(39)
  7. Else
  8. sqlDrivers = sqlDrivers & " OR FullName = " & Chr(39) & CmbDrivers.Text & Chr(39)
  9. End If
  10.  
  11. LstDrivers.AddItem (CmbDrivers.Text)
  12. CmbDrivers.RemoveItem CmbDrivers.ListIndex
  13.  
  14. Else
  15.  
  16. MsgBox "Please Select Driver", vbOKOnly, "Error"
  17.  
  18. End If
  19.  
  20. End Sub


This button is clicked on completeion:

VB Code:
  1. Private Sub BtnComplete_Click()
  2.  
  3. If DeDailyTakings.CnWeekly.State = adStateOpen Then
  4.  
  5. DeDailyTakings.CnWeekly.Close
  6.  
  7. End If
  8.  
  9.  
  10. Dim CalVal As Integer
  11. Dim CalYear As Integer
  12.  
  13. CalVal = (Format(Calendar.Value, "ww", vbWednesday))
  14. CalYear = Calendar.Year
  15.  
  16. RptSelectWeekly.Sections("Section2").Controls("LblWeeknumber").Caption = (Format(Calendar.Value, "ww", vbWednesday))
  17.  
  18. DeSelectWeekly.QrySelectWeekly sqlDrivers, CalVal, CalYear
  19.  
  20. Unload Me
  21. FrmMainMenu.Show
  22.  
  23. RptSelectWeekly.Show
  24.  
  25. 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