Trailer Id Check Macro

A

Ann

Since I didn't get a reply from my email, dated 9/17
regarding Set Up Trailer Macro, I found a way to set up
but I'm can't seem get out of the loop.

I was able to check the Trailer Id number in the FORM
against the data in the SUBFORM. And if they don't
match ...
BEEP , MSGBOX , and force the user to enter Check Out
Trailer Date and Time in the Update Trailer Check Out form
before creating another new Trailer Check In entry.
Thanks,

I created a Check Trailer id# macro, with a condition to
check if
Date and Time Out IS NULL on the Trailer Check In Form
upon user entering new Trailer numbers. I added an Action
to OpenForm =Update Trailer Form and it goes directly to
the record to be updated from the Check In Trailer Form.
The user enters the Trailer id# in the unbound box, and
clicks Date and Time Out, where I have another macro
attached to update Date and Time Out field. But I'm having
a problem when I close the Update Trailer Form, the
Trailer Check In form is still open and won't allow me to
enter new records. I hit the esc key, but I continue to
receive the Msgbox " Check Trailer Date and Time Out
Field" . I have a StopMacro Action, but it doesn't seem to
work. Can someone help with figuring out how my users can
enter new records?
 
K

Ken Snell

I'm having problems following the process that is occurring with your forms.
Let me see if I'm missing the boat here.

You have a form (apparently named "Trailer Check In"?) on which a user
enters a "Trailer ID" value into an unbound textbox. You have a macro that
checks that this Trailer ID value is found in one of the subform's records
(on which event do you run this macro?). If they don't match, you force the
user to enter a Check Out Time and Check Out Date (on the same form? on a
different form?).

(I am not understanding why you run a macro to see if the date and time
controls have Null values?)

You use a macro to open the form "Update Trailer Check Out" so that the user
can enter a date and time (so it appears that the date and time are entered
on this form and not on the first form?). And the user must enter the
Trailer ID value again on this form?

And then, after the user enters a Trailer ID, you force the user to enter a
date and time through a macro (running on which event?) before he/she can
close the Update Trailer Check Out form. This form writes the information to
a table, which I assume is used by the first form and its subform in some
way?

The problem that you then describe is that, after closing the Update Trailer
Check Out form, the first form (apparently named "Trailer Check In"?)
continues to show the error message that took the user to the Update Trailer
Check Out form? Again, on what event do you display that error message? Is
it that the same message is still showing? or that it is again displayed
when you try to continue with the Trailer ID value that was just entered on
the Update Trailer Check Out form?

If I'm following correctly what you want to do, it appears that you need to
do a requery of either the main form and/or the subform (the first form) as
part of the Update Trailer Check Out form's closing process. You could do
this in that form's OnClose event.

However, please clarify the info and provide additional details so that we
can better understand what you're doing. I have a vague sense that the
macros that you've set up may not be the "best" way to do what you seek, but
I cannot tell this from the info posted so far.
 
K

Ken Snell

Thanks for this additional explanation. I have one more question... I am
confused over the sequence of events when you open the "Update Trailer Check
Out" form (when the Date/Time control is null). What is the exact sequence
that causes a message box to be displayed? Normally, when a message box is
displayed, all code ceases until the user acknowledges/answers the message
box...thus, if you open the message box before the Update Trailer Check Out
form is opened, I am not understanding how a message box can still be seen
after you work in the form (let alone working in the form, which should not
be possible while the message box is open).
--
Ken Snell
<MS ACCESS MVP>



Ann said:
Thanks for responding.....
I decided to run a macro, to force the users to verify the
Trailer Id has been Checked Out before entering another
instance of the same Trailer Id into the database again.
The process is Trailer arrives at the Gate, user Checks
Trailer In on Check In form. When the Trailer leaves the
Gate, user should Check Out Trailer via Trailer Check Out
form.
Sometimes the users don't Check Out the Trailers,
therefore the Trailer Id has multiple instances of Check
In times without being Checked Out. This is causing
confusion.
I created a Check In form with Subform to show the Trailer
Id's history of the Date/Time Check In and Date/Time Check
Out occurs.

I added the macro to the Check In form on the Date/Time In
field. (I couldn't get to work on the Trailer Id field).
When the user enters the Trailer Id upon arriving to the
gate, they enter Trailer id # TR488 etc, then press enter,
all the history for the TR488 pops up on the subform for
the user to see. When they tab to next field, Date/Time
In, the macro was added to OnExit event, Check Trailer
Date/Time Out " is null", then Openform " Update Trailer
Check Out. The user sees a message box, it Opens the
Update Trailer Check Out form, they enter the Trailer Id#
into an unbound field [Trailer Id#] then press enter, the
Trailer id TR488 pops up, they click on the field that has
a macro, [Date/Time Out]which is set to Now(). They save
the Update Trailer Check Out form and click a button to
close it. My problem, is the Trailer Check In form is
still Open, and it continues to display the same message
box as before. I updated the Trailer Id macro to have it
CancelEvent and StopMacro, but it still keeps me in a
loop. Hope it helps.
-----Original Message-----
I'm having problems following the process that is occurring with your forms.
Let me see if I'm missing the boat here.

You have a form (apparently named "Trailer Check In"?) on which a user
enters a "Trailer ID" value into an unbound textbox. You have a macro that
checks that this Trailer ID value is found in one of the subform's records
(on which event do you run this macro?). If they don't match, you force the
user to enter a Check Out Time and Check Out Date (on the same form? on a
different form?).

(I am not understanding why you run a macro to see if the date and time
controls have Null values?)

You use a macro to open the form "Update Trailer Check Out" so that the user
can enter a date and time (so it appears that the date and time are entered
on this form and not on the first form?). And the user must enter the
Trailer ID value again on this form?

And then, after the user enters a Trailer ID, you force the user to enter a
date and time through a macro (running on which event?) before he/she can
close the Update Trailer Check Out form. This form writes the information to
a table, which I assume is used by the first form and its subform in some
way?

The problem that you then describe is that, after closing the Update Trailer
Check Out form, the first form (apparently named "Trailer Check In"?)
continues to show the error message that took the user to the Update Trailer
Check Out form? Again, on what event do you display that error message? Is
it that the same message is still showing? or that it is again displayed
when you try to continue with the Trailer ID value that was just entered on
the Update Trailer Check Out form?

If I'm following correctly what you want to do, it appears that you need to
do a requery of either the main form and/or the subform (the first form) as
part of the Update Trailer Check Out form's closing process. You could do
this in that form's OnClose event.

However, please clarify the info and provide additional details so that we
can better understand what you're doing. I have a vague sense that the
macros that you've set up may not be the "best" way to do what you seek, but
I cannot tell this from the info posted so far.
--
Ken Snell
<MS ACCESS MVP>






.
 

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