chk box event

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

Guest

Hi I am trying to update a date field, so when I click on a check box todays
date appears.

Private Sub chkSendToCollections_Click()
Me.chkSendToCollections = -1
Me.TxtDateSent = (Date)
End Sub

couple of things, the date automatically popultaes wether the chkbox is
invoked,2) what if i uncheck the box can I reverse the code with an else
statement.

Thanks
 
Actually, the best place to put this is in the After Update event:
Private Sub chkSendToCollections_AfterUpdate()
Me.txtDateSent = Iif( Me.chkSendToCollections,Date(),Null)
End Sub

This will put the date in if the check box is checked and take it out if it
is unchecked. Note the syntax in the Iif statement. If it is checked, it
evaluates to True (-1) and unchecked it evaluates to False(0). I suggest
always using True or False rather than -1 or 0 for clarity.
 
thanks that worked gr8, the next ? is. I have a table that needs to hold that
date. Is their a way to code it, the expression builder doesn't seem to work

Thanks
 
Is this a bound or an unbound form?

coconutt said:
thanks that worked gr8, the next ? is. I have a table that needs to hold that
date. Is their a way to code it, the expression builder doesn't seem to work

Thanks
 
It will be a bit hard to give you an exact answer because I don't know what
data you need to put in what table. I know you are asking about the date,
but you will need to be able to determine what record the data goes into.
Does it go into an existing record or are you creating a new record?
 
i have a table that will hold the date info, my thought is to use the form as
I make collection calls, and when i click the send to collections check box
the date field invokes on the form and then stores in the table.
 
I understand what you are asking, but I don't know enought about the detail
to give a specific answer. If you can answer the following questions, then
perhaps we can find a solution:
1. What, other than the date are you going to store in the table?
2. Will this be updating an existing record in the table, or adding a new
record to the table?
3. What is the key value for the table?
4. How are you creating records in the table now?
5. How are you looking up the information in the database to make the call?
 
1) I will be storing patient demographic information
2) Yes it will be updating an existing record
3) The key value is the patient account number
4) At this point i am importing an excell spreadsheet which is generated
from my scheduling software.
5) I plan on using the formI created to modify and search for records in the
table.

Thanks
 
Back
Top