473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Invalid use of Property MS Access 2010

Hi, I'm trying to assign a value to a field. eg
Expand|Select|Wrap|Line Numbers
  1. Me.pcmammogram-confirmed = "Yes"
. However after I click or attempt to write somewhere else the system puts a space between the field. See below:

Expand|Select|Wrap|Line Numbers
  1. Me.pcmammogram-confirmed = "Yes" (this is how its written)
  2. Me.pcmammogram -confirmed = "Yes" (This is how it looks 
then I get this error: "Invalid Use of Property".
Please help! Thanks.
Jan 13 '14 #1
3 1741
try
Expand|Select|Wrap|Line Numbers
  1. [Me.pcmammogram-confirmed] = "Yes"
Sometimes this works for normally invalid field names.

It's adding that space because it thinks the "-" is subtraction.

I'm assuming this is VBA.
Jan 13 '14 #2
zmbd
5,501 Expert Mod 4TB
1)2)kthprog - invalid field names - hit it on the head.

3)Please use the [CODE/] button to format posted script and formated text - Please read the FAQ
Jan 13 '14 #3
NeoPa
32,556 Expert Mod 16PB
Z
"kthprog - invalid field names - hit it on the head."

He did, but unfortunately the example fix he posted wasn't quite correct. Try instead :
Expand|Select|Wrap|Line Numbers
  1. Me.[pcmammogram-confirmed] = "Yes"
Now consider a couple of other issues.
  1. The item you refer to as a field is actually a control. Not too important but it helps when trying to communicate.
  2. Naming of items is much better done without using invalid characters where possible. The minus (-) is not recommended for use in names for the fairly obvious reason that it can easily be misunderstood.
    Also, if the name is PC Mammogram Confirmed, then this is much easier to read if you use capitals in the right places. Consider a name of PCMammogramConfirmed.
  3. If the field that the control is bound to is a Boolean field (One that takes Yes/No; True/False etc.) then assigning a string value to it, as your code showed, will not work as expected. In VBA a True value is written as True without any quotes.
Jan 14 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: jaad | last post by:
Hello, I have a database that was written in access 2007 on my pc. I wanted to work off site with the database so I uploaded it onto my laptop which is loaded with access 2010 beta. When I...
2
by: sierra7 | last post by:
It seems Access 2010 is associating an 'input mask' or field type with a combo box when a form is opened, even though there is no Format setting on the control. I have a form which has been...
1
by: Alan Yim | last post by:
Hi folks, My company recently upgraded our Office suite from 2003 to 2010. The problem in particular is with an Access database that was originally designed in Access 2003. The code in question...
2
by: Bill Boord | last post by:
I need to be able to shut off the AutoCorrect "feature" within Access 2010 code. I have utilized Application.SetOption with method strings for other startup requirements, but I cannot seem to find a...
5
by: neelsfer | last post by:
I got a new work laptop last week with Access 2010 pre-loaded.I also installed the new Office 2010 service pack 1. I then loaded 2 of my regularly used Access 2007 + service pack 2 applications on...
9
by: Vernon Halsey | last post by:
I have an Access database that has been is use for approx 8 years. It was originally written in 2000 and subsequently converted to 2003. It consists of a client-unique front-end linked to a shared...
4
by: jbrumbau | last post by:
Hello, In Access 2010/2007, how do you prevent users from flipping into design view from the ribbon? I do not want to hide the entire ribbon (DoCmd.ShowToolbar "Ribbon", acToolbarNo) or even the...
4
beacon
by: beacon | last post by:
Hi everybody, My title may not exactly describe my issue, so please forgive my lack of creativity today. I've got a database that was created in Access 2003 that I've opened in Access 2010. I...
11
by: Jo Ann Dullum | last post by:
I have a table in Sharepoint 2010 that users have submitted proposals into. I have a link to it in my Access 2010 database. The link works perfectly on my XP laptop but not on my Windows 7 desktop....
3
by: rahul2310 | last post by:
I want to disable function keys in access 2010,for that i am using code on forms on key down event. Code is 'The forms Key Preview property must be set to Yes Private Sub Form_KeyDown(KeyCode As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.