Dale,
You have been getting good advice from the other people here. The
following is another and different approach.
The following Access subroutine assumes a bound form with field names
like ISBN, Code, Category, Publisher, etc. My client wanted to put in
almost duplicate records in her bookstore database when the ISBN of
two (or more) books are equal, without keying
in the substantive data.
"rstBookData(0)" is not used since that is the physical key of the
record and defined as auto-num.
Private Sub ProcessDupISBN()
Dim cnnBookData As New ADODB.Connection
Dim rstBookData As New ADODB.Recordset
Set cnnBookData = CurrentProject.Connection
Dim workkey As String
Dim sqlstring As String
DuplicateISBN = "no"
workkey = ISBN
sqlstring = "Select * from tblBookData "
sqlstring = sqlstring & " where tblBookData.ISBN = '" & workkey & "'"
sqlstring = sqlstring & ";"
rstBookData.Open sqlstring, cnnBookData, adOpenStatic, adLockUnspecified
On Error GoTo NoDup
ScannerData = rstBookData(1)
Code = rstBookData(2)
ISBN = rstBookData(3)
Category = rstBookData(4)
Publisher = rstBookData(5)
House = rstBookData(6)
Genre = rstBookData(7)
Auth1First = rstBookData(8)
Auth1Last = rstBookData(9)
Auth2First = rstBookData(10)
Auth2Last = rstBookData(11)
Title = rstBookData(12)
Month = rstBookData(13)
Year = rstBookData(14)
Vol = rstBookData(15)
Number = rstBookData(16)
Series = rstBookData(17)
Format = rstBookData(18)
Notes = rstBookData(19)
Holiday = rstBookData(20)
Keywords = rstBookData(21)
Language = rstBookData(22)
Reviews = rstBookData(23)
Price = rstBookData(24)
SoldOut = rstBookData(25)
DuplicateISBN = "yes"
NoDup:
rstBookData.Close
End Sub
Dick
--- In [email protected], "Dale" <[EMAIL PROTECTED]> wrote:
>
> I have an access2002 database which has several tables linked to
> another read only sql database. I am trying to develop a form in my
> database where a person will select a person from a drop down and then
> all of their information will populate to the form and also be able to
> add to a comments box I will create and when I hit the next button it
> will store that data to the table I developed. I currently have a table
> which I have all of the possible fields I will need to store. I also
> have a query which populates all of the information from the various
> linked tables. For example, the query has the personsid, firstname,
> lastname, address, etc. I was able to create a form and make a combo
> box which gets the data from the query and then stores the id number in
> the table when I click next, however, I need to also get it to store
> the other information with it. Where am I going wrong.
>
> Thanks,
> Dale
>