error on load .....wow!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Oh no!

hi he,

when to load my form 'Myform1' in the event of to load I put the code
very simple that is docmd.gotorecord,,aclast and oh no.., things happened
of errors.
The error is because I deleted all records from my table and when to
open on load it closed automatically. Can you do the codes to avoid the
erros.

Thanks,
 
ooxx said:
Oh no!

hi he,

when to load my form 'Myform1' in the event of to load I put
the code very simple that is docmd.gotorecord,,aclast and oh no..,
things happened of errors.
The error is because I deleted all records from my table and
when to open on load it closed automatically. Can you do the codes
to avoid the erros.

Thanks,

You might try this:

Private Sub Form_Load()

If Me.Recordset.RecordCount <> 0 Then
DoCmd.GoToRecord , , acLast
End If

End Sub
 
I inserted the same code in the load form event and have to problem.

Private Sub Form_Load()
DoCmd.GoToRecord , , acLast
End Sub

Obviously, I emptied the table.
 
Maha Arupputhan Pappan said:
I inserted the same code in the load form event and have to problem.

Private Sub Form_Load()
DoCmd.GoToRecord , , acLast
End Sub

Obviously, I emptied the table.

But if the form doesn't allow additions, or its recordsource query is
nonupdatable, that code will raise an error. I can only guess that's
the case here.
 
In the scenario that Ooxx explained, I think he must already make the form to
accept data addition and edit enabled. I personally tried a form with Data
Entry set to Yes and No with the same code in the Form Load event and have no
problem. All I did is set the Record Source to the desired table.
 
Maha Arupputhan Pappan said:
In the scenario that Ooxx explained, I think he must already make the
form to accept data addition and edit enabled. I personally tried a
form with Data Entry set to Yes and No with the same code in the Form
Load event and have no problem. All I did is set the Record Source to
the desired table.

Yes, I tried that, too. You only get an error if the form has no
records, not even the "new record". So that may be the problem here,
unless it's due to some corruption or other circumstances we can't guess
about.
 
Thanks

Your assertions really much help. On the other words, if records
was filled not empty, could you help make the code ,while on load to view the
last three in detail section, if there were all 10 or 100 records.

Thanks
 
ooxx said:
Thanks

Your assertions really much help. On the other words, if
records was filled not empty, could you help make the code ,while on
load to view the last three in detail section, if there were all 10
or 100 records.

I'm afraid I don't understand what you're asking. Maybe it would be
best if you started a new thread with a message that explains in more
detail exactly what it is you want to do. Bear in mind that the word
"last", when talking about a set of records, is only meaningful when
some sort order has been applied to the records.
 
Back
Top