John,
I really appreciate all of your help and I don’t want to abuse your
kindness. If you have a few minutes to elaborate on a couple of things it
would be helpful. I have never done anything like this dispatch system before
so I’m learning as I go along. I’ve used Access in the past but only for
queries and reports.
How do I do this? I didn’t see anything in Help that refers to it.
It isn't in the Help, though it turns up a lot on the newsgroups.
Basically, you would use a simple Long Integer field and increment it
using VBA code when a new incident is added. If the IncidentID is the
*only* required field in the table, you could use code like this in
the Form's BeforeInsert event (which fires when a new record is first
created):
Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtIncidentID = DMax("[IncidentID]", "[Incidents]") + 1
Me.Dirty = False
End Sub
This will look up the largest existing IncidentID; add one, and write
the new number to the textbox txtIncidentID (which you would have
bound to the IncidentID field in the table); and immediately save the
record to disk by setting the Form's Dirty property to False.
I don’t like the way this works either but I didn’t know how else to go
about it. I’m using a Switchboard that opens the desired forms. I’m trying to
allow the dispatcher to enter a date/time that the officer called on-scene.
It needs to be entered into the appropriate record (usually, but not always
the last).
I’m not sure what you mean.
Well... just what I say.
The dispatcher should - in my opinion - have more control over the
"date/time that the officer called onscene" than can be provided by
using the Form's Open or GotFocus events. Think about it: the form
might already be open when the officer calls in; the dispatcher might
need to enter records from a couple of hours ago, typing in the time;
etc.
It may be simplest for the dispatcher to a) get a call from the
officer; b) open the Form (if it's not already open) and select the
incident - perhaps it can default to the most recent but you do need
the option; and c) doubleclick in the date/time field indicating when
the officer arrived. The code I posted can be copied and pasted into
the Event Procedure for that textbox, and will fill in the current
system clock date and time when the dispatcher doubleclicks.
Maybe I'm still not understanding what specific difficulty you are
encountering! Is it the form navigation, or what?
John W. Vinson[MVP]