My mistake, take out the me. In control sources, it doesn't work.
=DMin("TopX","ScoresTable", InvThisYr & " >= MinBreak")
--
Dave Hargis, Microsoft Access MVP
"JK" wrote:
> Well, now it's at least doing something.
> I'm getting #Name? in the score field instead of the score.
>
> Field1: InvThisYr (bound)
> Field2: Score (unbound)
> Field2 Control Source: =DMin("TopX","ScoresTable",Me.InvThisYr & " >=
> MinBreak")
>
> I made both fields the same data type and that didn't seem to help.
>
>
>
> "Klatuu" wrote:
>
> > Jk,
> > I think it is a matter of where you are putting the DLookup and the correct
> > syntax.
> > You should have a text box to display the rank and the control source should
> > have the Dmin function in it preceeded with an =
> >
> > =DMin("TopX", "tblTopX", Me.txtDollars & " >= MinBreak")
> >
> >
> > --
> > Dave Hargis, Microsoft Access MVP
> >
> >
> > "JK" wrote:
> >
> > > I can't get it to work... I've spent all day on this... I'm ready to shoot
> > > myself.
> > > I'm not even sure I'm going at this correctly. I thought a DLookup would be
> > > the easiest way to pull the TopX value.
> > >
> > >
> > >
> > > "(E-Mail Removed)" wrote:
> > >
> > > > On Aug 6, 1:31 pm, JK <jasonk at necoffeeco dot com> wrote:
> > > > > My frmCompanies form is bound directly to my tblCompanies table. I'm not
> > > > > using a query and I'm pretty sure I'm doing that for a reason. I think when I
> > > > > used a query I had trouble adding records... I don't know. Anyway, I copied
> > > > > the form and added a query and tried to use your example and was unable to
> > > > > make it work.
> > > > >
> > > > > What about adding something like this to the Form_AfterUpdate event?
> > > > > I just can't seem to make it work.
> > > > >
> > > > > Depending on where the customer's invthisyr amount falls in the ScoresTable
> > > > > I want to populate an unbound text box on my customer form with matching TopX
> > > > > (1-5)
> > > > >
> > > > > If Not IsNothing(Me.InvThisYr) Then
> > > > > Me.TopX = DLookup("[TopX]", "ScoresTable", "([InvThisYr]) >= " &
> > > > > [ScoresTable].[MinBreak] & " And ([InvThisYr]) >= " &
> > > > > [ScoresTable].[MaxBreak])
> > > > > End If
> > > > >
> > > > > That would do it, wouldn't it?
> > > > >
> > > > > "pietlin...@hotmail.com" wrote:
> > > > > > use something like this in a query.
> > > > >
> > > > > > Point the variable at your column name instead of a control on a form.
> > > > >
> > > > > > DMin("TopX", "tblTopX", "MaxBreak>=" & Me.txtDollars)
> > > >
> > > > Try If Not IsNull(Me.InvThisYr) then...
> > > >
> > > > IsNothing tests to see if an object variable is pointing at something.
> > > > (like a recordset)
> > > >
|