Thread: VBA duplication
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Keith74 Keith74 is offline
external usenet poster
 
Posts: 120
Default VBA duplication

Hi

The code i posted was more of a general principle thing as i don't
know exactly how you're set up. To make it a little more prescriptive
the select should be something like

mySQL = "SELECT PortfolioName FROM <tablename where PortfolioName is
found WHERE PortfolioName = ''" & <your textboxname.value & "'"

What we're doing is running a simple select to determine is the name
in your textbox already exists on the database. The results of the
query are checked using

If myRecordsSet.BOF = True and myRecordsSet.EOF = True then

The "myRecordSet" is whatever you have Dimmed you recordset object as,
and the "myRecordsSet.BOF = True and myRecordsSet.EOF" checks to see
if the recordset is empty, i.e that name doesn't exist on the table.

If you're still having trouble pm me.

Keith