Auto Select Date via check box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..
 
Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


TonyT said:
Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

rdwest01 said:
I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Correct on the code being vba thru code builder.
Not quite sure what you are actually wanting to acheive here, but checkboxes
can be selected and unselected as many times as you like, the code I gave you
will *fire* every time the check box value is changed ie checked or unchecked.
Perhaps it would be easier if you try and do what you can then post another
question if it doesn't as you hoped, it's alot easier for us to work with
actual code to help you.

good luck,

TonyT..

rdwest01 said:
Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


TonyT said:
Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

rdwest01 said:
I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Tony:

I have entered the name changes and the code to reflect the changes. The
check
box field is now Last _Used, the date filed is now Date_Used. As a rookie I
ahve entered the code as follows. This is the date that was within the code
for the particular form. Unfortunately, it doesn't change the date at all.
I assume I've made an error somewhere. Any help would be great.

Option Compare Database

Private Used_for_AfterUpdate() 'After update event for the checkbox
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else: Me.[Date_Used] = ""
'Me.[Question Field] = 'umm not sure what you mean by reset Question
'Field or what you question control name is.'
End If
End Sub

Private Sub Form_Load()

End Sub


Rudy


TonyT said:
Correct on the code being vba thru code builder.
Not quite sure what you are actually wanting to acheive here, but checkboxes
can be selected and unselected as many times as you like, the code I gave you
will *fire* every time the check box value is changed ie checked or unchecked.
Perhaps it would be easier if you try and do what you can then post another
question if it doesn't as you hoped, it's alot easier for us to work with
actual code to help you.

good luck,

TonyT..

rdwest01 said:
Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


TonyT said:
Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

:

I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
:
Tony:

Even better. The Check Box field is named Used_for, the date field is
Date_Used. I have used the following:

Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date - 1
End If
End Sub

This only work with a date already in the date field and subtracts the date.
What I would like the check box to actually do is once actioned to populate
the date field with the current date. ie, if I did it today, todays date
would populate the field. I don't want to manually have to enter every time
the date.


Rudy
Tony:

I have entered the name changes and the code to reflect the changes. The
check
box field is now Last _Used, the date filed is now Date_Used. As a rookie I
ahve entered the code as follows. This is the date that was within the code
for the particular form. Unfortunately, it doesn't change the date at all.
I assume I've made an error somewhere. Any help would be great.

Option Compare Database

Private Used_for_AfterUpdate() 'After update event for the checkbox
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else: Me.[Date_Used] = ""
'Me.[Question Field] = 'umm not sure what you mean by reset Question
'Field or what you question control name is.'
End If
End Sub

Private Sub Form_Load()

End Sub


Rudy


TonyT said:
Correct on the code being vba thru code builder.
Not quite sure what you are actually wanting to acheive here, but checkboxes
can be selected and unselected as many times as you like, the code I gave you
will *fire* every time the check box value is changed ie checked or unchecked.
Perhaps it would be easier if you try and do what you can then post another
question if it doesn't as you hoped, it's alot easier for us to work with
actual code to help you.

good luck,

TonyT..

rdwest01 said:
Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


:

Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

:

I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else Me.[Date_Used] = ""
End If
End Sub

Try It like that, and make sure you don't have any field, control or
variables left around in code that have Date in them as separate words.
No reason why that shouldn't work that I can see!

TonyT..

rdwest01 said:
:
Tony:

Even better. The Check Box field is named Used_for, the date field is
Date_Used. I have used the following:

Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date - 1
End If
End Sub

This only work with a date already in the date field and subtracts the date.
What I would like the check box to actually do is once actioned to populate
the date field with the current date. ie, if I did it today, todays date
would populate the field. I don't want to manually have to enter every time
the date.


Rudy
Tony:

I have entered the name changes and the code to reflect the changes. The
check
box field is now Last _Used, the date filed is now Date_Used. As a rookie I
ahve entered the code as follows. This is the date that was within the code
for the particular form. Unfortunately, it doesn't change the date at all.
I assume I've made an error somewhere. Any help would be great.

Option Compare Database

Private Used_for_AfterUpdate() 'After update event for the checkbox
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else: Me.[Date_Used] = ""
'Me.[Question Field] = 'umm not sure what you mean by reset Question
'Field or what you question control name is.'
End If
End Sub

Private Sub Form_Load()

End Sub


Rudy


TonyT said:
Correct on the code being vba thru code builder.
Not quite sure what you are actually wanting to acheive here, but checkboxes
can be selected and unselected as many times as you like, the code I gave you
will *fire* every time the check box value is changed ie checked or unchecked.
Perhaps it would be easier if you try and do what you can then post another
question if it doesn't as you hoped, it's alot easier for us to work with
actual code to help you.

good luck,

TonyT..

:

Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


:

Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

:

I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Tony

We're getting closer. I entered and made sure as per your suggestion. The
date disaapears after I uncheck the check box and refresh the form. When I
re-check the check box, and refresh the form the date remains unpopulated
with todays date or any other date.

TonyT said:
Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else Me.[Date_Used] = ""
End If
End Sub

Try It like that, and make sure you don't have any field, control or
variables left around in code that have Date in them as separate words.
No reason why that shouldn't work that I can see!

TonyT..

rdwest01 said:
:
Tony:

Even better. The Check Box field is named Used_for, the date field is
Date_Used. I have used the following:

Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date - 1
End If
End Sub

This only work with a date already in the date field and subtracts the date.
What I would like the check box to actually do is once actioned to populate
the date field with the current date. ie, if I did it today, todays date
would populate the field. I don't want to manually have to enter every time
the date.


Rudy
Tony:

I have entered the name changes and the code to reflect the changes. The
check
box field is now Last _Used, the date filed is now Date_Used. As a rookie I
ahve entered the code as follows. This is the date that was within the code
for the particular form. Unfortunately, it doesn't change the date at all.
I assume I've made an error somewhere. Any help would be great.

Option Compare Database

Private Used_for_AfterUpdate() 'After update event for the checkbox
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else: Me.[Date_Used] = ""
'Me.[Question Field] = 'umm not sure what you mean by reset Question
'Field or what you question control name is.'
End If
End Sub

Private Sub Form_Load()

End Sub


Rudy


:

Correct on the code being vba thru code builder.
Not quite sure what you are actually wanting to acheive here, but checkboxes
can be selected and unselected as many times as you like, the code I gave you
will *fire* every time the check box value is changed ie checked or unchecked.
Perhaps it would be easier if you try and do what you can then post another
question if it doesn't as you hoped, it's alot easier for us to work with
actual code to help you.

good luck,

TonyT..

:

Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


:

Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

:

I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Can you post the code exactly as you are using it, sounds like something is
not evaluating to true when it should do.

TonyT..

rdwest01 said:
Tony

We're getting closer. I entered and made sure as per your suggestion. The
date disaapears after I uncheck the check box and refresh the form. When I
re-check the check box, and refresh the form the date remains unpopulated
with todays date or any other date.

TonyT said:
Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else Me.[Date_Used] = ""
End If
End Sub

Try It like that, and make sure you don't have any field, control or
variables left around in code that have Date in them as separate words.
No reason why that shouldn't work that I can see!

TonyT..

rdwest01 said:
:
Tony:

Even better. The Check Box field is named Used_for, the date field is
Date_Used. I have used the following:

Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date - 1
End If
End Sub

This only work with a date already in the date field and subtracts the date.
What I would like the check box to actually do is once actioned to populate
the date field with the current date. ie, if I did it today, todays date
would populate the field. I don't want to manually have to enter every time
the date.


Rudy

Tony:

I have entered the name changes and the code to reflect the changes. The
check
box field is now Last _Used, the date filed is now Date_Used. As a rookie I
ahve entered the code as follows. This is the date that was within the code
for the particular form. Unfortunately, it doesn't change the date at all.
I assume I've made an error somewhere. Any help would be great.

Option Compare Database

Private Used_for_AfterUpdate() 'After update event for the checkbox
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else: Me.[Date_Used] = ""
'Me.[Question Field] = 'umm not sure what you mean by reset Question
'Field or what you question control name is.'
End If
End Sub

Private Sub Form_Load()

End Sub


Rudy


:

Correct on the code being vba thru code builder.
Not quite sure what you are actually wanting to acheive here, but checkboxes
can be selected and unselected as many times as you like, the code I gave you
will *fire* every time the check box value is changed ie checked or unchecked.
Perhaps it would be easier if you try and do what you can then post another
question if it doesn't as you hoped, it's alot easier for us to work with
actual code to help you.

good luck,

TonyT..

:

Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


:

Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

:

I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Tony:

I had a thought, so I rebuilt the form from scratch using the code you
supplied. With the new form it works fine. I've noticed Access 2000 does
this alot. Thanks for all the help.

Rudy

TonyT said:
Can you post the code exactly as you are using it, sounds like something is
not evaluating to true when it should do.

TonyT..

rdwest01 said:
Tony

We're getting closer. I entered and made sure as per your suggestion. The
date disaapears after I uncheck the check box and refresh the form. When I
re-check the check box, and refresh the form the date remains unpopulated
with todays date or any other date.

TonyT said:
Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else Me.[Date_Used] = ""
End If
End Sub

Try It like that, and make sure you don't have any field, control or
variables left around in code that have Date in them as separate words.
No reason why that shouldn't work that I can see!

TonyT..

:



:
Tony:

Even better. The Check Box field is named Used_for, the date field is
Date_Used. I have used the following:

Private Sub Used_for_AfterUpdate()
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date - 1
End If
End Sub

This only work with a date already in the date field and subtracts the date.
What I would like the check box to actually do is once actioned to populate
the date field with the current date. ie, if I did it today, todays date
would populate the field. I don't want to manually have to enter every time
the date.


Rudy

Tony:

I have entered the name changes and the code to reflect the changes. The
check
box field is now Last _Used, the date filed is now Date_Used. As a rookie I
ahve entered the code as follows. This is the date that was within the code
for the particular form. Unfortunately, it doesn't change the date at all.
I assume I've made an error somewhere. Any help would be great.

Option Compare Database

Private Used_for_AfterUpdate() 'After update event for the checkbox
If Me.[Used_for] = -1 Then
Me.[Date_Used] = Date
Else: Me.[Date_Used] = ""
'Me.[Question Field] = 'umm not sure what you mean by reset Question
'Field or what you question control name is.'
End If
End Sub

Private Sub Form_Load()

End Sub


Rudy


:

Correct on the code being vba thru code builder.
Not quite sure what you are actually wanting to acheive here, but checkboxes
can be selected and unselected as many times as you like, the code I gave you
will *fire* every time the check box value is changed ie checked or unchecked.
Perhaps it would be easier if you try and do what you can then post another
question if it doesn't as you hoped, it's alot easier for us to work with
actual code to help you.

good luck,

TonyT..

:

Tony:
Thanks for the idea. I assume this is to be inout using the code builder
within the form. The names will be changed. The idea would include the
check box being unseleted and once unselected would now become avail to be
re-selected with the new date. Ie the question could be re-used and a new
Last Used date applied.


Rudy


:

Try something like;

Private Select_AfterUpdate() 'After update event for the checkbox
If Me.[Select] = -1 Then
Me.[LastUsed] = date()
Else: Me.[LastUsed] = ""
Me.[Question Field] = 'umm not sure what you mean by reset Question
Field or what you question control name is.
End If
End Sub

You should seriously think about changing your field names - Select is a
reserved word, and spaces in control names is also asking for trouble - try
using _ instead.

TonyT..

:

I have a form I have created using a query (Access 2000) using all the fields
from the query in the form. This form is being used to create exam questions
from a database. The form name is "All Questions" the check box is
designated "Select". I would like to use the select check box. so that when
selected the current date is selected and place in the date field. The date
field is designated " "Last Used". I would also like the form to reset the
question once the check box has been "unselected" Can this be done? If so,
how? ANy help would be great. Someone at work suggested something along the
line of:

=Forms![All Questions]![Select] Date()
 
Back
Top