Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error -2147417848: Method 'Value' of object...failed

Status
Not open for further replies.

dkbrowne

Programmer
Feb 13, 2004
9
US
I'm getting "Run-time error '-217417848 (80010108)': Method 'Value' of object '_AccessField' failed" on a simple textbox value assignment.

The VBA statement in question ("Me!VisitID = GetSiteID() & Me!VisitNum") is in the BeforeInsert event of a subform, and the textbox which fails on the assignment is bound to the primary key of one of the tables in the subform's record source. Altho I first suspected the GetSiteID function to be the problem source, it turns out that even setting the Me!VisitID value to a simple string constant fails. The same thing works fine in the parent form's BeforeInsert event ("Me!ClientID = GetSiteID() & Me!ClientNum").

The bizarre thing is that this runs fine on the other 6 PC's at the same site, and the 3 other PC's at a remote site. The PC that fails consistently is running Windows 2000 with Access 2000, like several of the other PCs. I've uninstalled and reinstalled Access (2000) on that PC and made sure there was adequate disk space and memory available, defragged the disk and done everything I can think of that might relate to this PC being different from the others. Any ideas as to what am I missing?

Altho I've seen this same error message in other messages in this forum, I've not seen a solution yet...just various "work arounds" that haven't worked for me - schum1 solved it by changing the bang operator to a dot, but that didn't help in my case. I'd appreciate any suggestions you might have.

Thanks!
 
Try setting up a string and looking at that string. Like this

ss = chr(34)& Me!VisitID = " & GetSiteID() & Me!VisitNum) & chr(34)

msgbox ss

eval(ss)


rollie@bwsys.net
 
Sorry

ss = chr(34)& "Me!VisitID = " & GetSiteID() & Me!VisitNum) & chr(34)

See what that looks like and be surprised.
 
Thanks for responding.

I inserted the suggested code (minus the extra right paranthesis in the second example, so that it would compile) and ran it. The msgbox displays the statement I'm trying to execute, including the quotation marks around it:

"Me!VisitID = GetSiteID() & Me!VisitNum"

But the eval statement which followed did nothing....or at least it didn't force the above statement to execute. The VisitID textbox value remains null, which isn't good, since it's bound to the the primary key.

I've never used 'eval' before so didn't know what to expect. From reading about it in VBA Help, tho, doesn't it just evaluate an expression, eg. the (GetSitedID() & Me!VisitNum) portion of the above statement? Rather than actually doing the "left side of the equals sign is assigned the value of the right side" operation?

In other words, I'm confused....what am I missing?

Deb
 
Do not use the quotes. That is, eliminate the chr(34)'s from each end.

If you would like, send me a zipped sample and I will return the modified code.

rollie@bwsys.net
 
Ok, I removed the quotes (chr(34)) at the start and end so the message box displays:

Me!VisitID = LVG881

which is the valid statement (with the right side evaluated) I want executed. But the eval statement (directly following the message box) now gives a new error message:

Run-time error '2482': Client Database can't find the name 'Me' you entered in the expression.

Any idea what that's about?

By the way, I do appreciate your time - thanks for staying with this...

Deb
 
Deb,

We are sneaking up on it!!

"Me!VisitID = '" & GetSiteID() & Me!VisitNum) & "'"

See the tic's (read apostrophies) that I added. Otherwise the compiler thinks that LVG881 is avariable name. It must read 'LVG881'

The key is NEVER GIVE UP!!!

rollie@bwsys.net
 
I added the apostrophies as suggested, and got the same error message - "Run-time error '2482': Client Database can't find the name 'Me' you entered in the expression."

The code now looks like this:

Code:
ss="Me!VisitID = '"& GetSiteID()& Me!VisitNum & "'"
msgbox ss
eval(ss)


The msgbox displays: Me!VisitID = 'LVG885'
and then the eval statement gives the Run-time error

I'm not clear on what we're trying to do here....force the eval statement to actually do the Me!VisitID assignment?

Deb

P.S. Your statement has an extra right paran after Me!VisitNum, which I have removed so the code will compile. Should there instead be a matching left paran somewhere?
 
Would you like to send me a zipped sample? Otherw ise what is the runtime error number?

rollie@bwsys.net
 
As stated in my previous reply, the error message is:

"Run-time error '2482': Client Database can't find the name 'Me' you entered in the expression."
 
Ok, I changed the bang to a dot operator, and got the same error message. To be clear, this is the code I tried:

Code:
ss="Me.VisitID = '"& GetSiteID()& Me.VisitNum& "'"
MsgBox ss
Eval (ss)

The msgbox displays: Me.VisitID = 'LVG889'

and then the eval statement gives:

Run-time error '2482': Client Database can't find the name 'Me' you entered in the expresstion.

Sigh.....What I'm going to try next is to simply put a "Let" before the original assignment statement. That works on my PC, but I can't try it on the one PC that consistently fails on that statement until tomorrow.

So the statement will read:

Code:
Let Me!VisitID = GetSiteID() & Me!VisitNum

Since the "Let" is implied anyway, it shouldn't make any difference. But since it's only the one PC that fails (on perfectly good statement), perhaps this small 'tweak' will work. I'll let you know tomorrow if it makes any difference.

Thanks for your efforts.

Deb
 
Deb,

"me." is an alias for a form. Are you in a form when you execute that call?


R
 
Yes, the statement is in the BeforeInsert event of a subform and it works fine on 9 of the 10 PCs running the database.

In fact the database has been running fine in it's current form for 10 months now. It was just when a different (used) PC was brought in that the problem started on that machine. As I mentioned earlier, I uninstalled and reinstalled Access on that machine, but it didn't get rid of the error.

Deb
 
This is a tough one. If you were in C or C++, I would suspect the compiler had not done a commit thus leaving the latest write in a cache. I have found the before_update to be a bit flakey for me. Can you think of another event to use?

Sorry I struck out!

Rollie
 
Because this happens on a new machine this may be a problem with Reference Librarys. ACCESS doens't always return the exact problem in its error message. Try checking the References by opening the form in design mode, clicking on Tools-References, and then looking for anyone with "missing" in front of it. If you find one, you may have to register the library again, or sometimes, its just a matter of unchecking the checkbox, and then rechecking it again.

PaulF
 
When troubleshooting this on the affected PC I did look at the references to be sure everything was checked that should have been (it was) and there was no indication of anything 'missing'. (I also assumed that if there was a library reference missing, there would have been compilation errors, but there aren't - is my logic flawed on this?)

BUT I didn't try unchecking and re-checking the references.....so I'll try that too, and let you know if it made a difference tommorrow.

Thank you both for the suggestions.

Deb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top