sorting/clearing

  • Thread starter Thread starter ben
  • Start date Start date
B

ben

i have a switchboard that i can open several different
forms. one form allows me to select records to be
displayed on a report through the use of check boxes.
I.E. i open the form, check the box of the records that i
want to compare, then close the form.

I would like to add two features to this form, but i cant
figure out how.

First and foremost...i would like to be able to reorder
each field through the use of a control button. This is
similar to what eBay and others use to sort their
auctions in ascending/descending order using price, year,
etc.......any suggestions/solutions will be appreciated.

Secondly...each time the form is opened, i would like to
make it clear the check boxes...i have tried to set the
check boxes to false in the On Open event, but i am an
access amatuer and cant get it to work...

once again, thanks for any help
Ben
 
You can sort a form by right-clicking the field you wish to sort by (whether
price, year, etc), and choosing "Sort Ascending". If you want to do it
programatically:
Me.OrderBy = "Price"
Me.OrderByOn = True

The check boxes are bound to a yes/no field in the table? To clear all the
boxes each time the form is opened, you could execute an Update query
statement in the form's Open event. Set the form's On Open property (Event
tab of the Properties box) to:
[Event Procedure]
Click the build button beside this (...) to open the code window. Enter the
RunSQL line in between the "Private Sub..." and "End Sub":

Private Sub Form_Open(Cancel As Integer)
RunSQL "UPDATE [MyTable] SET [MyYesNoField] = False WHERE [MyYesNoField]
= True;"
End Sub
 
I keep getting a compile error. Sytax error when i copy
the code into the builder...here is everything in the On
Open Builder:
I have changed the MyTable and myYesNofield to the
corresponding form in my database...


Option Compare Database
------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)

UPDATE [MyTable] SET [MyYesNoField] = False WHERE
[MyYesNoField]>= True;

End Sub
--------------------------------------------------
Private Sub Yes_No_Enter()

End Sub
--------------------------------------------------
Private Sub Yes_No_Exit(Cancel As Integer)

End Sub
---------------------------------------------------

-----Original Message-----
You can sort a form by right-clicking the field you wish to sort by (whether
price, year, etc), and choosing "Sort Ascending". If you want to do it
programatically:
Me.OrderBy = "Price"
Me.OrderByOn = True

The check boxes are bound to a yes/no field in the table? To clear all the
boxes each time the form is opened, you could execute an Update query
statement in the form's Open event. Set the form's On Open property (Event
tab of the Properties box) to:
[Event Procedure]
Click the build button beside this (...) to open the code window. Enter the
RunSQL line in between the "Private Sub..." and "End Sub":

Private Sub Form_Open(Cancel As Integer)
RunSQL "UPDATE [MyTable] SET [MyYesNoField] = False WHERE [MyYesNoField]
= True;"
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

ben said:
i have a switchboard that i can open several different
forms. one form allows me to select records to be
displayed on a report through the use of check boxes.
I.E. i open the form, check the box of the records that i
want to compare, then close the form.

I would like to add two features to this form, but i cant
figure out how.

First and foremost...i would like to be able to reorder
each field through the use of a control button. This is
similar to what eBay and others use to sort their
auctions in ascending/descending order using price, year,
etc.......any suggestions/solutions will be appreciated.

Secondly...each time the form is opened, i would like to
make it clear the check boxes...i have tried to set the
check boxes to false in the On Open event, but i am an
access amatuer and cant get it to work...

once again, thanks for any help
Ben


.
 
What happened to the RunSQL and the quotes around the statement?

Also it needs to be one line, i.e. the [MyYesNoField] >= True; is on the
same line as the WHERE.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")
ben said:
I keep getting a compile error. Sytax error when i copy
the code into the builder...here is everything in the On
Open Builder:
I have changed the MyTable and myYesNofield to the
corresponding form in my database...


Option Compare Database
------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)

UPDATE [MyTable] SET [MyYesNoField] = False WHERE
[MyYesNoField]>= True;

End Sub
--------------------------------------------------
Private Sub Yes_No_Enter()

End Sub
--------------------------------------------------
Private Sub Yes_No_Exit(Cancel As Integer)

End Sub
---------------------------------------------------

-----Original Message-----
You can sort a form by right-clicking the field you wish to sort by (whether
price, year, etc), and choosing "Sort Ascending". If you want to do it
programatically:
Me.OrderBy = "Price"
Me.OrderByOn = True

The check boxes are bound to a yes/no field in the table? To clear all the
boxes each time the form is opened, you could execute an Update query
statement in the form's Open event. Set the form's On Open property (Event
tab of the Properties box) to:
[Event Procedure]
Click the build button beside this (...) to open the code window. Enter the
RunSQL line in between the "Private Sub..." and "End Sub":

Private Sub Form_Open(Cancel As Integer)
RunSQL "UPDATE [MyTable] SET [MyYesNoField] = False WHERE [MyYesNoField]
= True;"
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

ben said:
i have a switchboard that i can open several different
forms. one form allows me to select records to be
displayed on a report through the use of check boxes.
I.E. i open the form, check the box of the records that i
want to compare, then close the form.

I would like to add two features to this form, but i cant
figure out how.

First and foremost...i would like to be able to reorder
each field through the use of a control button. This is
similar to what eBay and others use to sort their
auctions in ascending/descending order using price, year,
etc.......any suggestions/solutions will be appreciated.

Secondly...each time the form is opened, i would like to
make it clear the check boxes...i have tried to set the
check boxes to false in the On Open event, but i am an
access amatuer and cant get it to work...

once again, thanks for any help
Ben


.
 
The quotes and the RunSQL are gone because I changed
everything around trying to get it to work, and that was
the last combination I tried...

I re-entered the code, all on one line, as shown below:

RunSQL "UPDATE [Shaft Description Data Form - BEN Query -
Selection] SET [Yes/No] = False WHERE [Yes/No]= True;"

when i run it, it gives a compile error: sub not defined

how do i fix this?
ben
-----Original Message-----
What happened to the RunSQL and the quotes around the statement?

Also it needs to be one line, i.e. the [MyYesNoField] >= True; is on the
same line as the WHERE.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")
ben said:
I keep getting a compile error. Sytax error when i copy
the code into the builder...here is everything in the On
Open Builder:
I have changed the MyTable and myYesNofield to the
corresponding form in my database...


Option Compare Database
------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)

UPDATE [MyTable] SET [MyYesNoField] = False WHERE
[MyYesNoField]>= True;

End Sub
--------------------------------------------------
Private Sub Yes_No_Enter()

End Sub
--------------------------------------------------
Private Sub Yes_No_Exit(Cancel As Integer)

End Sub
---------------------------------------------------

-----Original Message-----
You can sort a form by right-clicking the field you
wish
to sort by (whether
price, year, etc), and choosing "Sort Ascending". If
you
want to do it
programatically:
Me.OrderBy = "Price"
Me.OrderByOn = True

The check boxes are bound to a yes/no field in the table? To clear all the
boxes each time the form is opened, you could execute
an
Update query
statement in the form's Open event. Set the form's On Open property (Event
tab of the Properties box) to:
[Event Procedure]
Click the build button beside this (...) to open the code window. Enter the
RunSQL line in between the "Private Sub..." and "End Sub":

Private Sub Form_Open(Cancel As Integer)
RunSQL "UPDATE [MyTable] SET [MyYesNoField] =
False
WHERE [MyYesNoField]
= True;"
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")

i have a switchboard that i can open several different
forms. one form allows me to select records to be
displayed on a report through the use of check boxes.
I.E. i open the form, check the box of the records that i
want to compare, then close the form.

I would like to add two features to this form, but i cant
figure out how.

First and foremost...i would like to be able to reorder
each field through the use of a control button.
This
is
similar to what eBay and others use to sort their
auctions in ascending/descending order using price, year,
etc.......any suggestions/solutions will be appreciated.

Secondly...each time the form is opened, i would
like
to
make it clear the check boxes...i have tried to set the
check boxes to false in the On Open event, but i am an
access amatuer and cant get it to work...

once again, thanks for any help
Ben


.


.
 
Okay: try adding "DoCmd." in front, i.e.:
DoCmd.RunSql "UPDATE

I presume you really do have a field named "Yes/No".

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

ben said:
The quotes and the RunSQL are gone because I changed
everything around trying to get it to work, and that was
the last combination I tried...

I re-entered the code, all on one line, as shown below:

RunSQL "UPDATE [Shaft Description Data Form - BEN Query -
Selection] SET [Yes/No] = False WHERE [Yes/No]= True;"

when i run it, it gives a compile error: sub not defined

how do i fix this?
ben
-----Original Message-----
What happened to the RunSQL and the quotes around the statement?

Also it needs to be one line, i.e. the [MyYesNoField] >= True; is on the
same line as the WHERE.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")
ben said:
I keep getting a compile error. Sytax error when i copy
the code into the builder...here is everything in the On
Open Builder:
I have changed the MyTable and myYesNofield to the
corresponding form in my database...


Option Compare Database
------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)

UPDATE [MyTable] SET [MyYesNoField] = False WHERE
[MyYesNoField]>= True;

End Sub
--------------------------------------------------
Private Sub Yes_No_Enter()

End Sub
--------------------------------------------------
Private Sub Yes_No_Exit(Cancel As Integer)

End Sub
---------------------------------------------------


-----Original Message-----
You can sort a form by right-clicking the field you wish
to sort by (whether
price, year, etc), and choosing "Sort Ascending". If you
want to do it
programatically:
Me.OrderBy = "Price"
Me.OrderByOn = True

The check boxes are bound to a yes/no field in the
table? To clear all the
boxes each time the form is opened, you could execute an
Update query
statement in the form's Open event. Set the form's On
Open property (Event
tab of the Properties box) to:
[Event Procedure]
Click the build button beside this (...) to open the
code window. Enter the
RunSQL line in between the "Private Sub..." and "End
Sub":

Private Sub Form_Open(Cancel As Integer)
RunSQL "UPDATE [MyTable] SET [MyYesNoField] = False
WHERE [MyYesNoField]
= True;"
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has
spurious "_SpamTrap")

i have a switchboard that i can open several different
forms. one form allows me to select records to be
displayed on a report through the use of check boxes.
I.E. i open the form, check the box of the records
that i
want to compare, then close the form.

I would like to add two features to this form, but i
cant
figure out how.

First and foremost...i would like to be able to reorder
each field through the use of a control button. This
is
similar to what eBay and others use to sort their
auctions in ascending/descending order using price,
year,
etc.......any suggestions/solutions will be
appreciated.

Secondly...each time the form is opened, i would like
to
make it clear the check boxes...i have tried to set the
check boxes to false in the On Open event, but i am an
access amatuer and cant get it to work...

once again, thanks for any help
Ben


.


.
 
Back
Top