Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Re: avoiding duplicate entries in an Access database


Message #1 by "Fina Mesina" <fina@m...> on Sat, 1 Mar 2003 03:54:58
change these line 
	
        If sSQL = "" then
		Call AddCustInfo()
	End if

to these
     
       if rs.EOF = true then
              call AddCustInfo()
       end if


Fina


> I have three tables in my db; customer, transaction, and equipment. 
c> ustomer number is an assigned number (not an autonember) and it is the 
p> rimary key of the customer table. It is also included in the 
transaction 
t> able.

> I am trying to write an SQL statement that will check the customer 
table 
f> or a matching entry prior to writing data to the customer table. This 
is 
t> he subroutine I have written to check, but it is causing the program 
to 
s> kip the customer table altogether:
'>  -------------------------------- '
P> rivate Sub CheckCustRec()
s> ExistCust = Request.Form("custNumber")
s> SQL = "SELECT Hospital_ID FROM Current_Customers WHERE Hospital_ID 
= '" & 
s> ExistCust & "%'"
S> et rs = conn.Execute(sSQL)	
	> If sSQL = "" then
	> 	Call AddCustInfo()
	> End if
E> nd Sub
'>  -------------------------------- '

> Thanks in advance for your help!!!
w> ayne
Message #2 by "wayne wanless" <wanless@n...> on Mon, 3 Mar 2003 13:56:24
I have changed the code per your suggestion and I am getting this error:

Microsoft VBScript compilation error '800a0401' 

Expected end of statement 

line 69 

sSQL = "SELECT Hospital_ID FROM Current_Customers WHERE Hospital_ID = '" 
&amp;

...wayne

> change these line 
	> 
 >        If sSQL = "" then
	> 	Call AddCustInfo()
	> End if

> to these
 >     
 >       if rs.EOF = true then
 >              call AddCustInfo()
 >       end if

> 
F> ina

> 
>>  I have three tables in my db; customer, transaction, and equipment. 
c> > ustomer number is an assigned number (not an autonember) and it is 
the 
p> > rimary key of the customer table. It is also included in the 
t> ransaction 
t> > able.

> > I am trying to write an SQL statement that will check the customer 
t> able 
f> > or a matching entry prior to writing data to the customer table. This 
i> s 
t> > he subroutine I have written to check, but it is causing the program 
t> o 
s> > kip the customer table altogether:
'> >  -------------------------------- '
P> > rivate Sub CheckCustRec()
s> > ExistCust = Request.Form("custNumber")
s> > SQL = "SELECT Hospital_ID FROM Current_Customers WHERE Hospital_ID 
=>  '" & 
s> > ExistCust & "%'"
S> > et rs = conn.Execute(sSQL)	
	> > If sSQL = "" then
	> > 	Call AddCustInfo()
	> > End if
E> > nd Sub
'> >  -------------------------------- '

> > Thanks in advance for your help!!!
w> > ayne
Message #3 by "Fina Mesina" <fina@m...> on Tue, 4 Mar 2003 13:47:31
there is something wrong with line 69. make sure that it is ended 
properly (semi-colon).


fina
 
> I have changed the code per your suggestion and I am getting this error:

> Microsoft VBScript compilation error '800a0401' 

> Expected end of statement 

> line 69 

> sSQL = "SELECT Hospital_ID FROM Current_Customers WHERE Hospital_ID 
= '" 
&> amp;

> ...wayne
Message #4 by "wayne wanless" <wanless@n...> on Wed, 5 Mar 2003 14:05:43
Fina,
I rewrote the SQL statement, and it works fine. Thanks for your help!
ww

  Return to Index