Move to specific Record on Form problem

T

TSIsolutions

Good Afternoon,

I am in the process of developing a POS application. I want certain
forms (On Open Event) to go directly to the last record. These forms
sometimes contain a ListView or Image Controls which are filled from a
function placed in the On Current event.

The problem that occurs is when I use Docmd.GotoRecord,, acLast or
DoCmd.RunCommand acCmdRecordsGoToLast my Image Control or my ListView
controls are blank. If I go to the previous record and then back, then
the controls are filled. When I do not use the GotoRecord event and the
Form Opens to the first record, all the controls are filled.

I have tried everything I can think of but it doesn't work. I know
the Curent Event is loaded since I tested the event by adding a MsgBox
to see if it loads. I have also tried to Refresh, Repaint and Requery
but it doesn't work.

If you wish to recreate the error, simply place an image control on a
form and use the LoadPicture Method in the Current Event or fill the
ListView control from the On Current event and add a GotoRecord,,
acLast in the On Open event.

I would REALLY appreciate any help I can get.

Lawrence
 
A

Albert D. Kallal

First, I would use the on-load event, not the on-open.

The on-open event is *quite* a early event, and you can STILL SET CANCEL =
TRUE. If you set cancel = true in this event, then FORM DOES NOT EVEN LOAD!!

Further, you cannot even modify, or change the values of fields/controls in
the on-open event. So, typically, this event is used for testing of
conditions, and *preventing* / *cancelling* the open of the form.

So, lets move our code over to the forms on-load event.

Try the goto record command, it should work in the on-load event just fine.
And, if your image code does not fire, or work, then add a call to your
code, such as:

Docmd.GotoRecord,, acLast
Call Form_Current <--- add this
 
T

TSIsolutions

Hi Albert,

Thanks for the reply. I switched my code over to the on-load procedure
and it worked!!! You have no idea how many different combinations I
tried. What threw me off from that option is that removing the
gotorecord method and opening the form to the first record would show
me the image or the listview control... I thought it was a glitch with
the use of these activex controls.

Thanks again for the help.
Just a note, I didn't need to call the form_current for the procedure
to work.
 

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