Re: Method or Data Member Not Found, but definitely there

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Matthew DeAngelis (mattd_at_proquestvc.com)
Date: 08/16/04


Date: Mon, 16 Aug 2004 07:50:32 -0700

TC wrote:

> Try referencing the fields seperately, to be sure which one is being
> objected to:
>
> dim v as variant
> v = me.postmoney
> v = me.postmoney2
> etc.
>
> BTW:
>
> - why ' Like "Between" ' ? No point using Like without any wildcards
> :-)
>
> - you say this is the last If statement in a series of If statements
> structured in the exact same way, but with different field names.
> Maybe have a single If statement in a function, and call the function
> repeatedly, passing the relevant fieldnames as parameters.
>
> HTH,
> TC
>
>
> "Matthew DeAngelis" <mattd@proquestvc.com> wrote in message
> news:#SA6o07fEHA.2908@TK2MSFTNGP10.phx.gbl...
> > I am having an odd problem with this code:
> >
> > If Not IsNull(Me.PostMoney) Then
> > If Me.PostMoneyCompValue Like "Between" Then
> > stSearchCriteria = stSearchCriteria & Trim("[PostMoney]
> > " & Me.PostMoneyCompValue & " " & Me.PostMoney & " And " &
> > Me.PostMoney2 & " " & Me.PostMoneyAndOr & " ")
> > Else
> > stSearchCriteria = stSearchCriteria & Trim("[PostMoney]
> > " & Me.PostMoneyCompValue & " " & Me.PostMoney & " " &
> > Me.PostMoneyAndOr & " ")
> > End If
> > End If
> >
> > This is the last If statement in a series of If statements
> > structured in the exact same way, but with different field names.
> > My problem is that the compiler chokes on Me.PostMoney2, saying
> > 'method or data member not found', despite the presence of the
> > field. In fact, if I type Me. to bring up the list of fields, I
> > can double-click PostMoney2 to add it, but the compiler still
> > refuses to recognize it. Previously, before I added PostMoney2, I
> > was getting the same error in that line for PostMoney, even though
> > the compiler accepted that field as part of the If Condition.
> >
> > Is there any reason why the compiler should acknowledge a field in
> > some instances and not in others?
> >
> >
> > Thanks,
> > Matt

Thanks TC, that works just fine, although it is a tad annoying to look
at. Any idea what is causing this problem?

Good catch on the Like Between, by the way :). I will look at creating
a catchall function.

Much Appreciated,
Matt



Relevant Pages

  • Re: COPY an Array Variant wich has 2 Dimensions with API
    ... > an exact copy of an array. ... > Dim aas variant ...
    (microsoft.public.vb.winapi)
  • Re: Messagebox displaying without being called
    ... This is AFAIK the exact text you'll have if you ... Dim o As Object=dt.DefaultView' Get the first DataRowView ... formatting happens) but for now I would say rather user code as what you ... exception is thrown. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Singles to Doubles
    ... Dim d1 As Double ... The best representation of a value as a single can use all 24 bits of mantissa, ... In the string domain the value is exact, and can be converted to a double using all 53 bits of precision. ...
    (microsoft.public.vb.general.discussion)
  • Re: VLookup Function in VB
    ... You are correct I did want it to be exact. ... dim Res as variant ... dim VlookupRng as range ... Sub TEST() ...
    (microsoft.public.excel.programming)
  • Re: Define a clock
    ... AllYou! ... >>BTW the exact same thing occurs for length. ... And mass. ...
    (sci.physics.relativity)