Help. I have inherited a very large database and now have an error code of
3219. This happens when a command button is clicked to insert info the
user
has typed into another form. The debug highlights the Set tblParts =
dbs.
OpenRecordset("Parts", dbOpenTable, dbReadOnly) line. I'm assuming it may
be
because of the dbReadOnly, but have no idea why it worked before. This db
has a separate back end as many people access it. The front end is on
each
desktop by a .bat file, with a copy of db automatically copied onto the
person's C drive, which is what it accesses unless a change has been made,
and a new version created. I'm not sure if you can help or not, just by
looking at this.
Thanks,
Lori
Private Sub Command27_Click()
Dim dbs As Database
Set dbs = DBEngine(0).OpenDatabase(strDbsReplica)
'Set dbs = DBEngine(0).OpenDatabase("C:\Program
Files\Engineering-Change-
Release\ECR Design Master 2.mdb")
Dim SQLAddPart, Answer As String
Dim tblParts As DAO.Recordset
Set tblParts = dbs.OpenRecordset("Parts", dbOpenTable, dbReadOnly)
Dim boolFoundIt As Boolean
boolFoundIt = False
SQLAddPart = "INSERT INTO Parts ( [Product Code], [Part Number],
Customer,
[Cust Appr Req], [Part Name], [Planner Code] ) " & _
"SELECT Forms![Parts]![Product Code] as ProdCode,
Forms![Parts]![Part
Number] AS PartNum, Forms![Parts]!Customer AS Cust,
[Forms]![Parts]![frame14]
AS boolCust, Forms![Parts]![Part Name] AS PartName, Forms![Parts]!text25
AS
PC;"
While Not tblParts.EOF
If tblParts.Fields(0).Value = Forms![Parts]![Product Code] Then
boolFoundIt = True
End If
tblParts.MoveNext
Wend
If boolFoundIt = False Then DoCmd.RunSQL SQLAddPart
Forms![New Revisions]![Product Code] = Me.Product_Code
Forms![New Revisions]![Part Number] = Me.Part_Number
Forms![New Revisions]![Customer] = Me.Customer
Forms![New Revisions]![Part Name] = Me.Part_Name
Forms![New Revisions]![Frame28] = Me.Frame14
Me.Part_Name.SetFocus
DoCmd.Close
Set tblParts = Nothing
Set dbs = Nothing
End Sub
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200808/1


|