Data member not found

Malcy

Registered User.
Local time
Today, 15:22
Joined
Mar 25, 2003
Messages
584
Hi. Got a wierd one here. I am using ACC2007 but with an ACC2003 db format.
Have set up a check to see if a project is already listed
Code:
    varProj = DLookup("[lngPr]", "tblProjects", "[lngPrEntity] = " & Me!txtEn & " And [lngPrType] =" & Me.cboProjType & " And [lngPrYear] = " & Me.cboYear)
I can confirm that the combo boxes are named correctly and if I type in Me.txt I get them listed in the pulldown box.
When I compile the cboProjType is highlighted with a "Method or Data member not found" error - but I know it is there and have double checked spelling etc
Anyone got any ideas?
Thanks
 
Are you sure that cboProjType is valid in VBA? Do you you have the correct references set?
 
If the datatype of the cboProjType is not number then you might need some more quotes

[lngPrType] =" & Me.cboProjType & "

[lngPrType] = '" & Me.cboProjType & "'
 
It could also just be that the form defintion is out of sync with it's module. (See how I avoided using the word "corruption" here?? Ahh... D'Oh!)

You can try the usual cleaning out methods (compact & repair I wouldn't particularly expect to sort anything - but a Decompile {Definition} should).
You could also try just pushing the control value into late (runtime) referenced mode by refering to it's value with
Me!cboProjType
or
Me("cboProjType")
though that's probably just being slightly lazy. ;-)
(Maybe do that just before the decompile anyway lol).
 
I wouldn't imagine (at this stage anyway) that the problem is being caused by data type delimitation - primarily because the problem cited is a compile error. And the data type problem wouldn't be determined until runtime.
(And the field name "lngPrType" is a bit of a clue of the implied type - even though I'm not a fan of prefixing field names with data type myself - I can't complain about its usefulness here lol ;-)
 
Well for what its worth the solution, in my case, was to rebuild the combo boxes and then add .value to the SQL
Why this was needed I do not know but anyway the new code is
Code:
varProj = DLookup("[lngPr]", "tblProjects", "[lngPrEntity] = " & Me!txtEn.Value & " And [lngPrType] =" & Me.cboProj.Value & " And [lngPrYear] = " & Me.cboYear.Value)
I am also slightly suspicious since when I use the command button wizard and try to set up the link criteria for a new form the left hand box, showing fields on my form, is blank.
I have run diagnostics and it found nothing; I have also imported into a new db shell but same issue.
Feeling a tad nervous!!
BTW This is ACC2007 running on Vista
 
>> "This is ACC2007 running on Vista"
Well... that is useful to know. Are the problems you report permanent? An Office Repair yields nothing better? (You've checked Allen Browne's list of 2007 issues yes?)

When you say
"Well for what its worth the solution, in my case"
does that mean you tried the suggestions as they were alone first - or were working on the changes you implemented already anyway.
(Just it doesn't seem as if you have - and it's good for future readers to know what was tried as opposed to what worked - compared to what was suggested).

Cheers.
 
Leigh
I tried the suggestions made and they did not work so I extemporised and found a work around (perhaps more appropriate term than a solution).
I am pretty sure I have had a similar SQL working previously and I know that I used to see the fields on my form when using wizard to link. That is why I am suspicious.
I will check Allen Browne's site since I have found it helpful before.
TBH I posted since I thought I must be missing something obvious but now I am getting nervous - which would be a shame since I am beginning to quite like ACC2007 and Vista after my initial reluctance.
 

Users who are viewing this thread

Back
Top Bottom