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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
Help with validation
Thanks! That was helpful.
|
Thread Tools | |
Display Modes | |
|
|