PDA

View Full Version : Special Characters



nepotist
09-23-2010, 06:12 AM
I would like to restrict users from using special characters in input field how do I do that?.

If I allow , how do I work around the error message that I would encounter while updating the database.

I have another question, I am looking at someone else database (2003). I went to tool and clicked on relationships and few tables pop up but with it doesn't show how each table is related to other. Is something that I am missing to not see the relationships?. I checked the table they are linked though. :doh:

Thank you

Imdabaum
09-23-2010, 08:10 AM
Often users don't take the time to draw out the relationships in the relationship tool. You can still identify indexes through the table design itself though.

nepotist
09-23-2010, 10:04 AM
But is there a way that I can view all the relationships?. And do you have any clue that can help me with my primary question?

Thank you

hansup
09-23-2010, 10:22 AM
I have another question, I am looking at someone else database (2003). I went to tool and clicked on relationships and few tables pop up but with it doesn't show how each table is related to other. Is something that I am missing to not see the relationships?. I checked the table they are linked though.

What value is returned when you run this statement in the Immediate Window?Debug.Print CurrentDb.Relations.Count

nepotist
09-23-2010, 11:15 AM
Zero
now I am worried.. should I be?

hansup
09-23-2010, 11:40 AM
Zero
now I am worried.. should I be?No, it simply means that you have no relationships defined in your database. That is why you're not seeing any relationship lines between your tables in the Relationship Window; there aren't any.

nepotist
09-23-2010, 11:44 AM
No, it simply means that you have no relationships defined in your database. That is why you're not seeing any relationship lines between your tables in the Relationship Window; there aren't any.

hmm Then how come when I pull up the main table shows the subdata from other table...

I am just confused as to how this guy has created the structure and how this application is being used by a client... :banghead:

hansup
09-23-2010, 11:56 AM
hmm Then how come when I pull up the main table shows the subdata from other table...
Open the table in Design View, then open the property sheet and look at the "Subdatasheet Name" property. I set mine to "[None]". But I think if it is "[Auto]" and you have a relationship which applies to that table, Access will figure out which to use as the subdatasheet. Perhaps you can supply a specific table name for that property without any relationships. Or relationships existed at the time the property was set, but the relationships were subsequently deleted. I really don't know because I prefer mine set to "[None]".

In any case the key is that CurrenDb.Relations.Count = 0 tells you there are no relationships.


I am just confused as to how this guy has created the structure and how this application is being used by a client... :banghead:Yes, that can certainly be challenging!

Some folks find this helpful: Tools -> Analyze -> Documenter. (That's the menu path for Access 2003.) Other than that, I can't suggests any shortcuts for analyzing your database's design.

nepotist
09-23-2010, 12:19 PM
I see "Subdatasheet name" Property is assigned some value.. guess that answers my question about relationships.

I need some help regarding the special characters,

hansup
09-23-2010, 12:24 PM
I need some help regarding the special characters,Yes, I saw that, but didn't have anything to offer.

Maybe it would help to tell us which characters you consider special and want to exclude. And/or tell which characters are not special and you want allowed.

I this a requirement you want enforced in the database table design? Or will you instead enforce the restriction through form controls? Or both?

I will warn you that I still may not be able to offer help on this one even if you supply this extra information. But hopefully someone else can.

nepotist
09-23-2010, 12:43 PM
I dont want to allow user to input any special character that causes an error. After user inputs the information I would run some queries and then update the data. During this process if the user uses special character like Apostrophe (') it pops up with a error. I want to avoid this and it doesn't matter if it is in database or through controls.

I appreciate you help hansup. Thank you!

hansup
09-23-2010, 01:07 PM
I dont want to allow user to input any special character that causes an error. After user inputs the information I would run some queries and then update the data. During this process if the user uses special character like Apostrophe (') it pops up with a error. I want to avoid this and it doesn't matter if it is in database or through controls.

I appreciate you help hansup. Thank you!See whether this table Validation Rule can be a useful starting point.Not Like "*[!a-z0-9_]*"
That rule should allow only letters, digits and the underscore character in values input into the text field where the validation rule is enforced.

However, I'm unsure whether that's really what you're looking for.

If your problem is narrower ... insert or update queries with text values which may include an apostrophe ... you can simply double up the apostrophes to avoid triggering a database engine error.NSERT INTO MyTable ( text_field)
VALUES (Replace("three o'clock", "'", "''"));
If neither of those suggestions are useful, please give us more details about what you want. Last time I asked you to tell us which characters you consider special. You mentioned apostrophe. Are there others?