I do appreciate the information you provided me. I was able to talk to a
visual basic programer and he wrote the following that works which does
what
I was trying to do.
Private Sub Check8_Click()
Dim libConn As ADODB.Connection
Dim rstLib As New ADODB.Recordset
Dim historySql As String
Set libConn = CurrentProject.Connection
rstLib.CursorType = adOpenDynamic
rstLib.LockType = adLockOptimistic
rstLib.Open "BOOKHISTORY", libConn, , , adCmdTable
With rstLib
.AddNew
!EMPLOYEE = Trim([CHECK OUT BY].Value)
!BOOKTITLE = [TITLE].Value
!DATECKOUT = [DATE CHECKED OUT].Value
!DATECKIN = Date
.Update
.Close
End With
Set rstLib = Nothing
MsgBox "Book Checked In!", vbInformation, "History"
RBear3 said:
AHHHH.
You have a one-to-many relationship with your books vs. transactions.
You
should have at least three tables here. (none of which would have the
same
fields, but different levels of data - inactive vs. active, history vs.
current, etc.) Each table will store completely different types of data
and
will have totally different fields. In a normalized database, you don't
have multiple tables with pretty much the same fields.
One would contain all the book information. The other table would
contain
the Dates that each book was checked out and in. You need to redesign
and
normalize your tables.
TblBook
BookIDNumber
Title
Author
Summary
BookInactive (checkbox when a book is no longer available)
etc.
TblTransactions
BookID
Transaction (check in or out)
Date
CustomerNumber
TblCustomers
CustomerNumber
CustFirstName
CustLastName
CustAddress1
CustAddress2
CustCity
CustState
CustZIP
CustHomePhone
CustomerInactive (checkbox)
etc.
You would maintain the book information in one table. Checking a book
out
or in would create a record in your transaction table.
If you are trying to track all of this in one table, then you are
"committing spreadsheet". Each table should contain one type of data
only.
You are maintaining several types of data in one big table.
Notice that in the above, we have a way to inactivate a book or a
customer.
This will allow you to still go back and view the history for those books
or
customers, but you can set it up so that they will not be available in
your
forms to perform transactions.
Post back you actual field names and definitions if you need help
"normalizing" your data.
Once you normalize, you can have a "customer" form with a subform showing
all the books they have checked out. You could have a "book" form
showing
all the times it was checked out and by whom. You could have a list of
all
the books checked out during a certain time frame. Lots of options. The
key is to build yourself a relational database first.
--
Hope that helps!
RBear3
..