I have combobox in my application where i am populating SSN of all the employee.I want to generate report when user select SSn from combo and dates from Cal. How do i select what user is selecting from Combo and write in my SQL . My Code is something like this.
Thanks in Advance
Private Sub Form_Load()
Set rs = New ADODB.Recordset
Dim sql As String
rs.Open "select SSN from EmpDetailInfo order by ssn", cnn, adOpenDynamic, adLockOptimistic
'"select [Firstname] + ' ' + [LastName] as name from EmpDetailInfo"
Do While Not rs.EOF
cboname.AddItem rs(0)
rs.MoveNext
Loop
cboname.Refresh
End Sub
Private Sub txtfrom_dblclick()
Cal.Show
End Sub
Private Sub txtto_dblclick()
Cal.Show
End Sub
Public Function sqlReport()
sqlReport = "select checkdate,grosspay, amountofcheck from empcheckinfo where ssn = ' " & ssn & "' and right(checkdate,4) + left(checkdate,4) between '" & txtfrom & "' and '" & txtto & "'"
End Function
Thanks in Advance
Private Sub Form_Load()
Set rs = New ADODB.Recordset
Dim sql As String
rs.Open "select SSN from EmpDetailInfo order by ssn", cnn, adOpenDynamic, adLockOptimistic
'"select [Firstname] + ' ' + [LastName] as name from EmpDetailInfo"
Do While Not rs.EOF
cboname.AddItem rs(0)
rs.MoveNext
Loop
cboname.Refresh
End Sub
Private Sub txtfrom_dblclick()
Cal.Show
End Sub
Private Sub txtto_dblclick()
Cal.Show
End Sub
Public Function sqlReport()
sqlReport = "select checkdate,grosspay, amountofcheck from empcheckinfo where ssn = ' " & ssn & "' and right(checkdate,4) + left(checkdate,4) between '" & txtfrom & "' and '" & txtto & "'"
End Function