|
-
Mar 11th, 2004, 09:02 AM
#1
Thread Starter
Frenzied Member
Data environment question, incrementing a recordset [*Not Resolved*]
Hello
I am using the datagrid and data environment. But my sql query does not work. Can anyone tell me what l am doing wrong from the code below.
Code:
Private Sub cmdNext_Click()
Dim strSQL As String
Dim monthName As String
'increment the months to display each month in the year
deSalaries.rscmdIncrementMonths.MoveNext
If deSalaries.rscmdIncrementMonths.EOF = True Then
deSalaries.rscmdIncrementMonths.MoveLast
End If
monthName = txtMonths 'Get the current month that is display and convert it to a date format
monthName = (CDate(monthName))
'Write out the sql query to find all the employees under the current month
strSQL = "SELECT `Month`.`MonthName`, " & _
"LinkMonthEmployee.EmployeeNo, " & _
"LinkMonthEmployee.Surname, " & _
"LinkMonthEmployee.AccountNo, " & _
"LinkMonthEmployee.EmployeeSalary, " & _
"LinkMonthEmployee.Position, " & _
"LinkMonthEmployee.Certificate, " & _
"LinkMonthEmployee.GrossSalary, " & _
"LinkMonthEmployee.Tax, " & _
"LinkMonthEmployee.SocialSecurity, " & _
"LinkMonthEmployee.NetSalary " & _
"FROM Month, LinkMonthEmployee " & _
"WHERE `Month`.MonthID = LinkMonthEmployee.MonthID AND Month`.MonthID = '" & monthName & "' "
'Set all the properties for the data environment
deSalaries.Commands("cmdAllDetails").CommandType = adCmdText
deSalaries.Commands("cmdAllDetails").CommandText = strSQL
dgrSalaries.DataMember = "cmdAllDetails" 'Set the datamember to cmdAddDetails
dgrSalaries.ReBind 'Rebind the datagrid to display all the employees under the current month that has been incremented
end sub
Not sure where l am going wrong with the above code, but it will not work but compiles ok. Not sure if l have set all the properties in the data environment. Any help will be most gratefull in solving this problem for me.
Many thanks in advance
Steve
Last edited by steve_rm; Mar 13th, 2004 at 10:41 AM.
steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|