Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

sql query vba dao

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » SQL query in VBA for DAO recordset

SQL query in VBA for DAO recordset

ResolvedVersion 2003

Paul has attended:
Access VBA course

SQL query in VBA for DAO recordset


Hi,
I can't seem to get the sql statement "qrystring" below quite right. It should be selecting the field [AssignedTo] from the query [QrySnapshotSummary] where the value of field [Assigned To team] in the same table equals the conent of combo box [cmbTeam] on the current form, called frmTeamKPIs. The results of this query become rstusers DAO recordset.

Please help.

Regards
Paul



Private Sub cmbTeam_Change()
Dim rstusers As DAO.Recordset
Dim intcount As Integer
Dim qrystring As String

Set db = CurrentDb

qrystring = "SELECT qrySnapshotSummary.AssignedTo FROM qrySnapshotSummary GROUP BY qrySnapshotSummary.AssignedTo, qrySnapshotSummary.[Assigned to team] HAVING (((qrySnapshotSummary.[Assigned to team])=Forms!frmTeamKPIs!cmbTeam));"
Set rstusers = db.OpenRecordset(qrystring)

RE: SQL query in VBA for DAO recordset

Hi Paul

Further to your post we have had a look at this and this is something we can assist with in a consultative fashion as it is does exceed the scope of the forum.

We are confident that by following the steps below we can resolve your issue.
1) Forward your working files to us along with key objectives
2) We shall review and respond with estimate of cost
3) On agreement of scope and costs, we shall complete the work and return the files.

If you wish to discuss this further then please let us know.

Regards

Jacob

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Access tip:

Open A Combo Box Automatically

This is helpful if users need to enter large amounts of data. There are two ways to open ComboBoxes when they get the focus by using the tab keys.

When the ComboBox gets focus:

Press Alt + Down Arrow on the keyboard

For it to happen automatically, needs a bit of coding:

1. Add a combo box and a text box control to the form
2. Set the combo box's On Got Focus property to the following event procedure:

Private Sub ComboBoxName _GotFocus()

Me!ComboBoxName.Dropdown

End Sub


3. Open your form in Form View and use the TAB key to make sure it works.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.