reg SQL query



Hi

During the FORM LOAD i'm loading the months and the current year in the combobox and text box respectively. The coding for month and year is given below.

For MONTH:

Dim i As Integer
For i = 1 To 12
combo1.AddItem Format(DateSerial(Year(Date), i, 1), "MMMM")
Next

For YEAR:

Dim i As Integer
Dim currentYear As Integer
currentYear = Year(Now)
txtYear.Text = currentYear

I need to connect the both to an SQL query.

I connected the YEAR to SQL query as

curYear = txtYear.text

But i don't know to connect the month with the SQL query.

The SQL query is given below

SELECT CONVERT(CHAR(25),TravelDate,103) as [Journey Date],EID
,Surname,Forename,' ' + RTRIM(FromAd) AS [From Adr], FromPostCode, ' '+
RTRIM(ToAd) AS [To Adr],ToPostCode FROM Journey
WHERE (MONTH(Journey.TravelDate) = " ? ")
AND (YEAR(Journey.TravelDate) = " & curYear & ")
AND (MileageInward IS Null OR MileageInward=0 OR
(ReturnJny=1 AND (MileageOutward IS Null OR MileageOutward=0)))
ORDER BY TravelDate, CallSignIn, AppTime, FromPostCode

I AM USING VISUAL BASIC 5.0. SO ANYONE CAN HELP TO GET RID OF THIS PROBLEM....
Reply ASAP.
Thanks in advance.

Regards,

Ram

.



Relevant Pages

  • How to connect month combobox to SQL query?
    ... Dim i As Integer ... Dim currentYear As Integer ... I need to connect the both to an SQL query. ... AND (MileageInward IS Null OR MileageInward=0 OR ...
    (microsoft.public.vb.com)
  • how to connect month combobox with the SQL query
    ... Dim i As Integer ... Dim currentYear As Integer ... I need to connect the both to an SQL query. ... AND (MileageInward IS Null OR MileageInward=0 OR ...
    (microsoft.public.vb.controls)
  • Re: reg SQL query
    ... Dim i As Integer ... Dim currentYear As Integer ... I need to connect the both to an SQL query. ... Even if the combobox is different between VB5 and VB6, at least try his code before posting another request for assistance. ...
    (microsoft.public.vb.controls)
  • Re: how to connect month combobox with the SQL query
    ... Dim i As Integer ... Dim currentYear As Integer ... I need to connect the both to an SQL query. ... I would change slightly how you're adding the months to the combobox by also assigning the month's numeric value to the ItemData ...
    (microsoft.public.vb.controls)
  • RE: NOVICE: SQL Query on a Timer, Growing Memory Size
    ... achieved by a sql query running in timed increments, ... Private Sub Timer1_Tick(ByVal sender As System.Object, ... Dim adapter3 As New SqlDataAdapter ... Dim ds3 As New Data.DataSet ...
    (microsoft.public.dotnet.languages.vb)