View Single Post
  #2  
Old July 6th, 2009, 05:50 PM posted to microsoft.public.access
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default "No Current Record" when adding new record

Hi TraciAnn -

I believe it may have to do with my OnCurrent Event for the form.


I believe you're right grin.

Here's a code snippet I use to test for an empty recordset; I failed to
record which one of the regulars here gave me the tip:

If Not (Me.Recordset.BOF AND Me.Recordset.EOF) Then 'skip all if
empty recordset
rem execute this code only if non-empty recordset
End If

Just a comment on style (personal preference?) -- if it were my code,
I'd change lines such as

Me.cmdGoToFirstFacility.Visible = True = (Me.CurrentRecord 1)


to

Me.cmdGoToFirstFacility.Visible = (True = (Me.CurrentRecord 1))

just for readability.

--
Clif

"TraciAnn via AccessMonster.com" u50702@uwe wrote in message
news:98ac7c9cb7430@uwe...
Hi All,

I have a main form (frmFacility) with a subform (fsubTraining) with a
subform
(fsubUserTraining).

Whenever I add a new record, while inserting characters in the first
field, I
receive a message box "No Current Record". After clicking "OK" I am
able to
continue and the record is inserted with no additional problems.

I believe it may have to do with my OnCurrent Event for the form.
==================
Private Sub Form_Current()
On Error GoTo Err_Form_Current

Me.cboFindFacility.Value = Me.FacilityID

If Me.FilterOn Then
Me.cboFindFacility.Enabled = False
Else
Me.cboFindFacility.Enabled = True
End If

Me.cmdGoToFirstFacility.Visible = True = (Me.CurrentRecord 1)
Me.cmdPreviousFacility.Visible = True = (Me.CurrentRecord 1)
Me.RecordsetClone.MoveLast 'could be any ie: Movefirst
Me.cmdNextFacility.Visible = True = (Me.CurrentRecord _
Me.RecordsetClone.RecordCount)
Me.cmdGoToLastFacility.Visible = True = (Me.CurrentRecord _
Me.RecordsetClone.RecordCount)

Exit_Form_Current:
Exit Sub

Err_Form_Current:
MsgBox Err.Description
Resume Exit_Form_Current

End Sub
==================
Any ideas?

Thanks!

--
---
TraciAnn

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1




--
Clif