|
Hello,
I am new to Vb and would be grateful if someone could assist me with the following problem with which i am having. Any pointers or advise would be gratefully appreciated.
I will explain the situation:
In my access database i have:
- one table entitled tblassociateinfo - one query entitled associatedetails - one form entitled reporting
In the reporting form i have three combo boxes, two of which are for a date parameters. I have added a calender so that the user can select the dates he requires data from. I have also added a third combo box for Manager information. So from date combo is called cbofromdate, to date is called cbotodate and manager combo is called cbomanager. I also have a button entitled getdata.
What i want to happen is put some code behind the Get Data button so that when the manager requests data, he enters his date parameters and selects his name and then clicks create. The code i have got to so far has encountered problems:
When i hit 'Get Data' and enter parameter box appears for Manager Name. I would like for it to bring up the query straight away rather than asking for parameters because the user has already specified the data they require. Below is the code i have used so far:
Private Sub getdata_Click()
Dim db as DAO.Database Dim qdf s DAO.Querydef Dim strSQL as string Set db = currentdb Set qdf = db.querydefs("associatedetails")
strSQL = "SELECT tblassociateinfo.* " & _ "FROM tblassociateinfo " & _ "WHERE tblassociateinfo.Date=' " & Me.cbostartdate.value & "' " & _ "AND tblassociateinfo.managername='" & me.cbomanager.value &"' " & _ "ORDER by tblassociateinfo.Date; "
qdf.SQL = strSQL DoCmd.OpenQuery "associatedetails" DoCmd.Close acform, Me.Name
setqdf = nothing set db = nothing
END SUB
any help at all ??
|