A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help with validation



 
 
Thread Tools Display Modes
  #1  
Old August 6th, 2009, 10:18 AM posted to microsoft.public.access.tablesdbdesign
Daniel Haley
external usenet poster
 
Posts: 5
Default Help with validation

I was wondering if someone could please help me with validation rules
for a table. I am running Access 2003.

I have a table called tblSite, which has the following fields:
1. SiteID (Autonumber)
2. SiteName (Text)
3. URL (Hyperlink)
4. DateCreated (Date)
5. DateModified (Date)

I am trying to validate the URL field. It is not a required field.
Here is my (non-functioning) existing rule:

Is Null Or Like ("http://*") Or Like ("https://*") Or Like ("ftp://*")
Or Like ("file://")

It does not work. Here is how it responds in the following situations:

Example Result
------------------------------
Null Value Works
http://test.com Validation message returned
test Validation message returned

If I change the like statements so they are Like("*http://*") -- note
the new wildcard -- it will accept the string I want, but it would also
accept nonsense like "BHDFihttp://"

I'm baffled. Perhaps the colon and slash cannot be used? Can anyone
provide insight?

Thanks,

Dan
  #2  
Old August 6th, 2009, 11:11 AM posted to microsoft.public.access.tablesdbdesign
Daniel Haley
external usenet poster
 
Posts: 5
Default Help with validation

I have found a workaround, although not a solution. If anyone has a
real solution please post it.

It seems that the hyperlink datatype contains more than what is
displayed on scheme. Without knowing how these strings are coded, I
cannot parse them.

Here's the work around.

1. Change the datatype of the URL field to text

2. Keep the same validation rule.

3. If you want to activate the URL, just create an event on a form. For
instance, if you want to go to the page when someone presses a command
button, insert this into the button's onclick event:

Application.FollowHyperlink Address:=Me.URL.value, newwindow:=True

I hope it helps someone else too.


In article
,
Daniel Haley wrote:

I was wondering if someone could please help me with validation rules
for a table. I am running Access 2003.

I have a table called tblSite, which has the following fields:
1. SiteID (Autonumber)
2. SiteName (Text)
3. URL (Hyperlink)
4. DateCreated (Date)
5. DateModified (Date)

I am trying to validate the URL field. It is not a required field.
Here is my (non-functioning) existing rule:

Is Null Or Like ("http://*") Or Like ("https://*") Or Like ("ftp://*")
Or Like ("file://")

It does not work. Here is how it responds in the following situations:

Example Result
------------------------------
Null Value Works
http://test.com Validation message returned
test Validation message returned

If I change the like statements so they are Like("*http://*") -- note
the new wildcard -- it will accept the string I want, but it would also
accept nonsense like "BHDFihttp://"

I'm baffled. Perhaps the colon and slash cannot be used? Can anyone
provide insight?

Thanks,

Dan

  #3  
Old August 6th, 2009, 11:52 AM posted to microsoft.public.access.tablesdbdesign
Keith Wilby
external usenet poster
 
Posts: 812
Default Help with validation

"Daniel Haley" wrote in message
news
I have found a workaround, although not a solution. If anyone has a
real solution please post it.


Have a look at the HyperlinkPart method in the help.

Keith.
www.keithwilby.com

  #4  
Old August 6th, 2009, 12:29 PM posted to microsoft.public.access.tablesdbdesign
Daniel Haley
external usenet poster
 
Posts: 5
Default Help with validation

Thanks! That was helpful.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.