Re: Form code fails when Openargs present...



Hi Dirk:

Connecting to JET tables...

This line calls the form:

DoCmd.OpenForm ("Frm_PatronCirculationInformation"), , , , , , "Patron_ID="
& Me.cboPatronFullname


>From Frm_PatronCirculationInformation:

Private Sub Form_Current()
On Error GoTo Err_Form_Current

Me.RecordsetClone.MoveLast
Me.cmdGoNext.Enabled = Not (Me.CurrentRecord =
Me.RecordsetClone.RecordCount)
Me.cmdGoPrevious.Enabled = Not (Me.CurrentRecord = 1)

If
Forms!Frm_PatronCirculationInformation!Frm_PatronCirculationInformationSubfo
rm.Form.RecordCount = 0 Then
Me.Frm_PatronCirculationInformationSubform.Visible = False
Else
Me.Frm_PatronCirculationInformationSubform.Visible = True
End If

Me.Recalc

If Me.txtPatronType_ID <> 0 Then
Me.txtStaffFullname.Visible = False
Else
Me.txtStaffFullname.Visible = True
End If


Exit_Form_Current:
Exit Sub

Err_Form_Current:
fncWRMSErrMsg Err.Number, Err.Description
Resume Exit_Form_Current

End Sub

Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
With Me.RecordsetClone
.FindFirst Me.OpenArgs
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub

Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

'Call fncLoadcbo([Form])



DoCmd.Maximize


Exit_Form_Open:
Exit Sub

Err_Form_Open:
fncWRMSErrMsg Err.Number, Err.Description
Resume Exit_Form_Open

End Sub



That's the code. Throws 2455. And it doesn't reposition correctly after
dismissing error message. No luck with similar changes in my "barebones"
test forms either. Sure hope I'm not doing something stupid, but I can't see
anything...

Thanks!
Fred



"Dirk Goldgar" <dg@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23A900lHRFHA.3096@xxxxxxxxxxxxxxxxxxxxxxx
> "Fred Boer" <fredboer1@xxxxxxxxxxxxxxx> wrote in message
> news:uKeelbHRFHA.1416@xxxxxxxxxxxxxxxxxxxx
> > Hi Dirk:
> >
> > Thanks for taking time to help me! I certainly feel bad to have
> > stressed poor Access, and didn't mean to make it feel overwhelmed! ;)
> >
> > I've tried putting the OpenArgs/Find process in the Load event,
> > rather than the Open event, but I still get the error message. To be
> > specific, I get the error message, and then when I clear the error
> > message, the form opens positioned to the correct record. It's like
> > Acess is saying "Wait, you did this wrong!", but then it works anyway.
> >
> > Now, I'm using the recordsetclone of the subform, but I don't know if
> > I need that. I have tried just using the recordset.recordcount of the
> > subform, in case that helped, but it didn't seem to...
> >
> > I haven't mentioned that I am working with linked back end tables.
> > That wouldn't be an issue would it? The OpenArgs code uses
> > .FindFirst...
> >
> > Still puzzling...
>
> Hmm, moving the code to the Load event fixed the problem for me. Are
> you sure you didn't leave the code in the Open event, as well as copying
> it to the Load event? Please post the complete code, as it is now, from
> the form's Open, Load, and Current events.
>
> Are the linked tables in a Jet database, or are they in an ODBC data
> source like SQL Server or MSDE?
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>


.



Relevant Pages

  • Re: Cannot assign a Value
    ... The Open event is too early: not all of the controls are instantiated until ... Realistically, since the Open event allows cancellation, and the Load event ... Private Sub cmdNote_Click ...
    (microsoft.public.access.forms)
  • Re: Not in list combo questions
    ... And this is on the On Load event of the pop up form. ... Private Sub Form_Load ... Dim NewData As String ...
    (microsoft.public.access.forms)
  • Re: Passing parameter from textbox
    ... I will now analyse the code what it does, so that i understand what is ... you may have faster load times if you don't populate the ... the page load event will fire before the ItemCommand event so ... >> Private Sub ItemCommand(ByVal source As Object, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Form Filter
    ... Private Sub Form_Load ... Why does the filter not seem to fully execute during the load event? ... "don't know" did you set filter to data during form load event or not. ...
    (comp.databases.ms-access)
  • Re: Not in list combo questions
    ... And this is on the On Load event of the pop up form. ... Private Sub Form_Load ... Response = acDataErrContinue ... vbCrLf & vbCrLf & _ ...
    (microsoft.public.access.forms)