Update Yes/No Field

  • Thread starter Thread starter LarryB
  • Start date Start date
L

LarryB

Jeff, thanks very much for the reply. I tried to reply to the original
thread but could not get through.

Sorry I'm kind of new to this Access game and code writing is definately
not one of my strong suits. Let me try and explain in a litte more
detail what I am trying to accomplish. I have 2 tables:

Vehicles Maintenance
Reg# (key field) AutoNumber (key)
Make Reg# (linke to Vehicles one-to-many)
(other info fields) Mileage (number)
Active (Yes/No - used to identify the
active maintenance record)
defaulted to Yes.
Comments (memo)

I have a form with Vehicles as the Main and Maintenance as a Subform
I have a query with all the fields and the criteria for Active is Yes.
I have a report based on the query that pulls the vehicles active record

Everything works fine as long as the operator remembers to change the
Yes to a No prior to entering a new record. What I would like to do is
have the Yes change automatically to No when the operator enters a new
record.

Any code sample or help that you can provide will be greatly
appreciated.

Thank you

Larry
 
LarryB said:
Jeff, thanks very much for the reply. I tried to reply to the
original thread but could not get through.

Sorry I'm kind of new to this Access game and code writing is
definately not one of my strong suits. Let me try and explain in a
litte more detail what I am trying to accomplish. I have 2 tables:

Vehicles Maintenance
Reg# (key field) AutoNumber (key)
Make Reg# (linke to Vehicles one-to-many)
(other info fields) Mileage (number)
Active (Yes/No - used to identify the
active maintenance record)
defaulted to Yes.
Comments (memo)

I have a form with Vehicles as the Main and Maintenance as a Subform
I have a query with all the fields and the criteria for Active is Yes.
I have a report based on the query that pulls the vehicles active
record

Everything works fine as long as the operator remembers to change the
Yes to a No prior to entering a new record. What I would like to do
is have the Yes change automatically to No when the operator enters a
new record.

Any code sample or help that you can provide will be greatly
appreciated.
There is no need for code. Set the default to False and all new records
will be false.
 
Mike, I tried that but it still leaves me with the problem of the
active record. The operator will have to manually change the Active
to Yes when he initially enters a new record. He will then have to
change the Yes to No prior to entering an additional new record. I
don't know if I'm making sense or not, sorry. My report which prints
out a dispatch form takes all the information from the current record
which is identified by the Active field with a Yes in it. All the
other records with No in the Active field are historical data that I
can retrieve if I need to check on the maintenance status. I hope
that you can help me resolve this problem
 
Larry,

It's possible to do it the way you want but I think you ought to remove the
criteria from the query, forget about this active stuff.

Normally when you print a report from a form you create a button and put
something like this in the "On Click" event:

******************************************
Dim strCriteria As String
strCriteria = "[Reg#] = " & ME.Reg#
DoCmd.OpenReport "YourReportName", acViewNormal, , strCriteria
****************************************************

This way you pass the filter into the report whenever you decide to print
it.
Take the criteria out of the query.
Let us know if it doesn't work.

Jack
 
Back
Top