auto populate field when query run

T

twalsh

I have a ticketing system running in access. When an employee creates a
ticket the "Status" field is defaulted to "Pending"

Ticket workers click a cmdbutton that opens a form based on a query meant to
find the oldest "pending" ticket.

When this form is opened or query is run, i would like to set the "Status"
as "Working" so that the next ticket worker doesnt get the same ticket.

I would really prefer not to have the ticket workers manually change the
status and update.....
 
J

John W. Vinson

I have a ticketing system running in access. When an employee creates a
ticket the "Status" field is defaulted to "Pending"

Ticket workers click a cmdbutton that opens a form based on a query meant to
find the oldest "pending" ticket.

When this form is opened or query is run, i would like to set the "Status"
as "Working" so that the next ticket worker doesnt get the same ticket.

I would really prefer not to have the ticket workers manually change the
status and update.....

You could use the form's Current event with code like:

Private Sub Form_Current()
If Me!Status = "Pending" Or Me.NewRecord Then
Me!Status = "Working"
Me.Dirty = False ' force a save of the record
End If
End Sub

Unfortunately this will make a record "Working" even if you just LOOK at it...
that may not be what you want! Perhaps you need an update query in the command
button's code, or another button on the form that the user can click to
indicate that they have actively decided that they ARE "working" on this
particular record.
 

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

Top