Quick syntax help in a combo box

T

Tal

I have a combo box that is defined by the selection in another combo box.
I need to order the data based on a date field.

So, Order by [tblFunds].[dtFundDate] DESC

I can't seem to get the right syntax.
Any help is appreciated.

Here is my current code:

Private Sub cboSelectCampaign_AfterUpdate()
Dim SFundSource As String
SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName] " & _
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value
Me.cboSelectFund.RowSource = SFundSource
Me.cboSelectFund.Requery

End Sub
 
B

bcap

SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName] " & _
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value & _
" Order by [tblFunds].[dtFundDate] DESC"
 
T

Tal

Perfect. Excellent. Fantastic. Thank you.
Can this also work with Group by?

Cheers,
Talia

bcap said:
SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName] " & _
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value & _
" Order by [tblFunds].[dtFundDate] DESC"

Tal said:
I have a combo box that is defined by the selection in another combo box.
I need to order the data based on a date field.

So, Order by [tblFunds].[dtFundDate] DESC

I can't seem to get the right syntax.
Any help is appreciated.

Here is my current code:

Private Sub cboSelectCampaign_AfterUpdate()
Dim SFundSource As String
SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName] "
& _
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value
Me.cboSelectFund.RowSource = SFundSource
Me.cboSelectFund.Requery

End Sub
 
B

bcap

Group By would be used in conjunction with some aggregate function. What
exactly are you thinking of doing?

Tal said:
Perfect. Excellent. Fantastic. Thank you.
Can this also work with Group by?

Cheers,
Talia

bcap said:
SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName] " &
_
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value & _
" Order by [tblFunds].[dtFundDate] DESC"

Tal said:
I have a combo box that is defined by the selection in another combo
box.
I need to order the data based on a date field.

So, Order by [tblFunds].[dtFundDate] DESC

I can't seem to get the right syntax.
Any help is appreciated.

Here is my current code:

Private Sub cboSelectCampaign_AfterUpdate()
Dim SFundSource As String
SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName]
"
& _
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value
Me.cboSelectFund.RowSource = SFundSource
Me.cboSelectFund.Requery

End Sub
 
T

Tal

I have a one to many relationship between Clients and Addresses, so in the
Client query, their names can appear more than once. However, most of the
time I just want to select their names and not worry about their addresses,
so I want the list to only have their names appear once. So, to Group by the
keyClient.


bcap said:
Group By would be used in conjunction with some aggregate function. What
exactly are you thinking of doing?

Tal said:
Perfect. Excellent. Fantastic. Thank you.
Can this also work with Group by?

Cheers,
Talia

bcap said:
SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName] " &
_
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value & _
" Order by [tblFunds].[dtFundDate] DESC"

I have a combo box that is defined by the selection in another combo
box.
I need to order the data based on a date field.

So, Order by [tblFunds].[dtFundDate] DESC

I can't seem to get the right syntax.
Any help is appreciated.

Here is my current code:

Private Sub cboSelectCampaign_AfterUpdate()
Dim SFundSource As String
SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName]
"
& _
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value
Me.cboSelectFund.RowSource = SFundSource
Me.cboSelectFund.Requery

End Sub
 
B

bcap

Hi,

Sorry, I still dont understand. Why don't you create a query which only
selects Clients records and doesn't join them to the Addresses records?

GROUP BY is relevant when you are aggregating using functions such as SUM or
COUNT. Eliminating duplicates is normally accomplished using the DISTINCT
keyword i.e. SELECT DISTINCT...

Tal said:
I have a one to many relationship between Clients and Addresses, so in the
Client query, their names can appear more than once. However, most of the
time I just want to select their names and not worry about their
addresses,
so I want the list to only have their names appear once. So, to Group by
the
keyClient.


bcap said:
Group By would be used in conjunction with some aggregate function. What
exactly are you thinking of doing?

Tal said:
Perfect. Excellent. Fantastic. Thank you.
Can this also work with Group by?

Cheers,
Talia

:

SFundSource = "SELECT [tblFunds].[keyFund], [tblFunds].[txtFundName] "
&
_
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value & _
" Order by [tblFunds].[dtFundDate] DESC"

I have a combo box that is defined by the selection in another combo
box.
I need to order the data based on a date field.

So, Order by [tblFunds].[dtFundDate] DESC

I can't seem to get the right syntax.
Any help is appreciated.

Here is my current code:

Private Sub cboSelectCampaign_AfterUpdate()
Dim SFundSource As String
SFundSource = "SELECT [tblFunds].[keyFund],
[tblFunds].[txtFundName]
"
& _
"FROM tblFunds " & _
"WHERE [tblFunds].[keyCampaign] = " &
Me.cboSelectCampaign.Value
Me.cboSelectFund.RowSource = SFundSource
Me.cboSelectFund.Requery

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top