Descending order

  • Thread starter ladybug via AccessMonster.com
  • Start date
L

ladybug via AccessMonster.com

I have the following code:
Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT active, class_id,
class_nm, available_dt FROM dbo_sds_trn_class ORDER BY active, available_dt
desc, class_nm;"


I want to sort by active first, but I want it to be descending..how do I put
that in this code?
 
M

mscertified

Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT active, class_id,
class_nm, available_dt FROM dbo_sds_trn_class ORDER BY active DESC,
available_dt
desc, class_nm;"

-Dorian
 
L

ladybug via AccessMonster.com

THANKS!
Do you happen to also know how I can create different colors if the active is
set to "N"? For example, if the entry has "active" equaling "N," then the
entire entry will be red?
Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT active, class_id,
class_nm, available_dt FROM dbo_sds_trn_class ORDER BY active DESC,
available_dt
desc, class_nm;"

-Dorian
I have the following code:
Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT active, class_id,
[quoted text clipped - 3 lines]
I want to sort by active first, but I want it to be descending..how do I put
that in this code?
 
M

mscertified

What do you need to be red? What does 'entry' mean?
If you have a form based on this query and you have a control on the form
which can be Y or N and you want it to be red if the value is N, that is
fairly easy
In your Current event put some code like:
If Me!Active = 'N' Then
Me!Active.Forecolor = vbRed
Else
Me!Active.Forecolor = vbBlack
End If
You could also change the background color or the border color, look in
Format properties to see what you might change.

-Dorian

ladybug via AccessMonster.com said:
THANKS!
Do you happen to also know how I can create different colors if the active is
set to "N"? For example, if the entry has "active" equaling "N," then the
entire entry will be red?
Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT active, class_id,
class_nm, available_dt FROM dbo_sds_trn_class ORDER BY active DESC,
available_dt
desc, class_nm;"

-Dorian
I have the following code:
Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT active, class_id,
[quoted text clipped - 3 lines]
I want to sort by active first, but I want it to be descending..how do I put
that in this code?
 
L

ladybug via AccessMonster.com

Sorry I should have been more clear. I have the following Event Procedure on
a Command Button:
DoCmd.OpenForm "frm_chooser"
Forms!frm_chooser.Caption = "Add or Edit Class"
Forms!frm_chooser!lbl_add.Caption = "Add Class"
Forms!frm_chooser!lbl_edit.Caption = "Edit Class"
Forms!frm_chooser!cmb_edit_choice.ColumnCount = "4"
Forms!frm_chooser!cmb_edit_choice.ColumnWidths = "0"";0"";2.5"";1"""
Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT class_id, active,
class_nm, available_dt FROM dbo_sds_trn_class ORDER BY active DESC,
available_dt desc, class_nm;"

The form frm_chooser opens from this Event Procedure. On the form there is a
combo box called cmb_edit_choice. This will return a list of class ids and
it's corresponding class name, date it became available, and whether it be
active ("Y" or "N"). If the active text box is set to "N" then I want the
class_id, class_nm, available_dt, etc. to appear red in cmb_edit_choice.

Does that help? What can I add in the code above to capture this?
What do you need to be red? What does 'entry' mean?
If you have a form based on this query and you have a control on the form
which can be Y or N and you want it to be red if the value is N, that is
fairly easy
In your Current event put some code like:
If Me!Active = 'N' Then
Me!Active.Forecolor = vbRed
Else
Me!Active.Forecolor = vbBlack
End If
You could also change the background color or the border color, look in
Format properties to see what you might change.

-Dorian
THANKS!
Do you happen to also know how I can create different colors if the active is
[quoted text clipped - 13 lines]
 
M

mscertified

Unfortunately, you cannot have some entries in a combo box one color and
others in a different color.

-Dorian

ladybug via AccessMonster.com said:
Sorry I should have been more clear. I have the following Event Procedure on
a Command Button:
DoCmd.OpenForm "frm_chooser"
Forms!frm_chooser.Caption = "Add or Edit Class"
Forms!frm_chooser!lbl_add.Caption = "Add Class"
Forms!frm_chooser!lbl_edit.Caption = "Edit Class"
Forms!frm_chooser!cmb_edit_choice.ColumnCount = "4"
Forms!frm_chooser!cmb_edit_choice.ColumnWidths = "0"";0"";2.5"";1"""
Forms!frm_chooser!cmb_edit_choice.RowSource = "SELECT class_id, active,
class_nm, available_dt FROM dbo_sds_trn_class ORDER BY active DESC,
available_dt desc, class_nm;"

The form frm_chooser opens from this Event Procedure. On the form there is a
combo box called cmb_edit_choice. This will return a list of class ids and
it's corresponding class name, date it became available, and whether it be
active ("Y" or "N"). If the active text box is set to "N" then I want the
class_id, class_nm, available_dt, etc. to appear red in cmb_edit_choice.

Does that help? What can I add in the code above to capture this?
What do you need to be red? What does 'entry' mean?
If you have a form based on this query and you have a control on the form
which can be Y or N and you want it to be red if the value is N, that is
fairly easy
In your Current event put some code like:
If Me!Active = 'N' Then
Me!Active.Forecolor = vbRed
Else
Me!Active.Forecolor = vbBlack
End If
You could also change the background color or the border color, look in
Format properties to see what you might change.

-Dorian
THANKS!
Do you happen to also know how I can create different colors if the active is
[quoted text clipped - 13 lines]
I want to sort by active first, but I want it to be descending..how do I put
that in this code?
 

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

Similar Threads


Top