Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #739

Re: Opening a form to a specific record leads to #error for one field

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "buckskin" <buckskin@mailinator.com>
Newsgroups comp.databases.ms-access
Subject Re: Opening a form to a specific record leads to #error for one field
Date Fri, 1 Apr 2011 05:19:19 +0100
Lines 63
Message-ID <8vl233F48oU1@mid.individual.net> (permalink)
References <8vklhiFn41U1@mid.individual.net> <kZqdnSwP97MBswjQnZ2dnUVZ_gidnZ2d@earthlink.com>
X-Trace individual.net std5LfrxaVp27q2yVK6vUAovSM+3y4IkqWD3ARpfbqersMbE5G
Cancel-Lock sha1:WBaW8B54XYFvpTeZuZ6p88+RKBQ=
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2800.2001
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2800.2001
Xref x330-a1.tempe.blueboxinc.net comp.databases.ms-access:739

Show key headers only | View raw


"Salad" <salad@oilandvinegar.com> wrote in message
news:kZqdnSwP97MBswjQnZ2dnUVZ_gidnZ2d@earthlink.com...
> buckskin wrote:
>
> > I'm opening a form like so;
> >
> > strWhere = "[id] = " & lngRpt
> > DoCmd.openform "frmCC_Choice", , , , , acDialog, "usercodes"
> >
> >
> > The form opens and I run this form in the open event
> >
> > 'Dao code courtesy of Allen Browne in 2006
> >
> > Dim rs As DAO.Recordset
> > With Forms!frmCC_Choice
> >     Set rs = .RecordsetClone
> >     rs.FindFirst strWhere
> >     If rs.NoMatch Then
> >         MsgBox "Not found"
> >     Else
> >         .Bookmark = rs.Bookmark
> >     End If
> > End With
> > Set rs = Nothing
> >
> > Me.RecordSource = "SELECT report_defs.*, report_defs.Type,
> > report_defs.DateModified FROM report_defs WHERE (((report_defs.Type) ="
&
> > "'C'" & ")) ORDER BY report_defs.DateModified DESC;"
> >
> > This all works - nearly.  I can open the form at the record I require
and
> > can then navigate the other records.
> > But the textbox bound to DateModified now shows #Error.
> >
> > If I remove that sorting field from the recordsource then it displays
ok.
> > It's obviously the sorting that screws things up (but I need it sorted).
> >
> > Is there a quick fix?
> >
> >
> Your statement
>    Me.RecordSource = "SELECT report_defs.*, report_defs.Type,
>      report_defs.DateModified FROM report_defs
>
> Why do you select Type and DateModified again.  They should already be
> selected in report_defs.*.

Ah good point.

>
> Why are you setting the bookmark prior to code for finding the record?

Hmmm, the perils of copy/pasting code without understanding what it is.  OK
so I should set the recordsource first then set the bookmark?
>
>
>

Back to comp.databases.ms-access | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Opening a form to a specific record leads to #error for one field "buckskin" <buckskin@mailinator.com> - 2011-04-01 01:45 +0100
  Re: Opening a form to a specific record leads to #error for one field "buckskin" <buckskin@mailinator.com> - 2011-04-01 02:13 +0100
  Re: Opening a form to a specific record leads to #error for one field Salad <salad@oilandvinegar.com> - 2011-03-31 20:47 -0500
    Re: Opening a form to a specific record leads to #error for one field "buckskin" <buckskin@mailinator.com> - 2011-04-01 05:19 +0100
      Re: Opening a form to a specific record leads to #error for one field Salad <salad@oilandvinegar.com> - 2011-04-01 07:52 -0500
    Re: Opening a form to a specific record leads to #error for one field "buckskin" <buckskin@mailinator.com> - 2011-04-01 10:25 +0100

csiph-web