School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,110 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,022 people online right now. Registration is fast and FREE... Join Now!




access vba problem

 

access vba problem

callmedanny

16 Jun, 2009 - 11:53 AM
Post #1

New D.I.C Head
*

Joined: 2 Jun, 2009
Posts: 4

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 ??



User is offlineProfile CardPM
+Quote Post


June7

RE: Access Vba Problem

16 Jun, 2009 - 06:53 PM
Post #2

D.I.C Regular
Group Icon

Joined: 9 Dec, 2008
Posts: 485



Thanked: 38 times
My Contributions
This is duplicate of VB6 forum post.

This post has been edited by June7: 16 Jun, 2009 - 06:53 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 01:07PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month