Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old February 20th, 2004, 03:52 AM
GenkiDave's Avatar
GenkiDave GenkiDave is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Canada
Posts: 60 GenkiDave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Record Duplication

Could anyone give me a hand as to how to write the proper VBScript for a database check
before the data is inserted?

It's for my MS Access movie database. The relevant info including tables are below.


Actors Table
Table Name: tblActors
Table Fields: fldActorID, fldAFname, fldALname


Movies Table
Table Name: tblMovies
Table Fields: fldMovieID, fldMovieName


Actor/Movie Join Table
Table Name: tblActorMovie
Table Fields: fldActorMovieID, fldActorID, fldMovieID


After I fill in the info for the new movie being inserted and click the Submit button I would like

to check;

If the Actor's first AND last name already exists (Eg. AFname = Harrison / ALname = Ford) Then

Use the Actor's ID number (Eg. ActorID = 2) and insert it into the Actor/Movie Join Table
and join it with the new MovieID

Else

Use the original method for inserting movies and actors (which works like a charm)

EndIf

I need to eliminate duplicated names in the Actors Table.
(Eg. ActorID=2 / AFname = Harrison / ALname = Ford AND ActorID=59 / AFname = Harrison / ALname = Ford)

Can anyone help me with this???

Reply With Quote
  #2  
Old February 23rd, 2004, 11:36 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Here is what I would do.

I would enter you movie, like you do, then I would select the actor from a combo box, IF the actor doesn't exisit in your combo box (which you populated from your actor list), then have an add actor button which the user will click on to enter a new actor. when the user is done entering the new actor, you will be brough back to your pervious form, with the actor info, now seleted in the combo box.

The reason I wouldn't go searching for an exisiting record (based on what you already have in the tables) is because of spelling mistakes. Lets say you type Harison Ford instead of Harrison Ford, and you don't realize you typed the name wrong. You have now just added another Harrison Ford to your actor table (which isn't a duplicate based on spelling). Having the user select an exisitng name (record) remove that problem.

S-

Reply With Quote
  #3  
Old February 26th, 2004, 06:38 PM
GenkiDave's Avatar
GenkiDave GenkiDave is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Canada
Posts: 60 GenkiDave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
I could do that, OR while I'm inserting the record, it can check for duplicate records with the %LIKE% attribute, that way if there IS a duplicate and I made a spelling mistake, a page can ask me: Did you mean - Harrison Ford and I can either click yes add to Harrison Ford's Movie connection via ActorID OR I can say no, add the new actor named Harison Fordd.

It's funny, I know what I want to do, but I just don't know HOW to do it.

Can anyone else give a helpful hand like sbaxter here? Thanks again sbaxter!

Reply With Quote
  #4  
Old March 1st, 2004, 02:04 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Problem with


%LIKE%

IS

I have Harrison in my system

I type
Harrisson

%Like% will not find Harrison


What you need to use in this case is Soundex You need to look for the name based on the sound and not spelling (won't work in all cases, but will get you close.

Look it up in help and internet for code samples.

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Record Duplication


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway