J
jkendrick75
I am needing help with an INSERT INTO statement.
I am using Access 2000 and i have three tables that are all linked together
on a particular field. I altered the following code from someone else's post
(as far as the MyDB.execute parts go).
Private Sub cmdSaveRecord_Click()
On Error GoTo Err_cmdSaveRecord_Click
Dim MyDB As DAO.Database
Set MyDB = CurrentDb
MyDB.Execute "Insert Into DBA_cs_part_profile_vw1 (Part, " _
& "Customer_Part) Values (" _
& [txtInternalPartNumber] & ", " _
& [txtExternalPartNumber] & ")"
MyDB.Execute "Insert Into DBA_part_machine_tool1 (Part, Machine " _
& "Tool) Values (" _
& [txtInternalPartMachine1] & ", " _
& [txtMachine] & ", " _
& [txtToolNumber] & ")"
MyDB.Execute "Insert Into DBA_part_machine1 (Part, parts_per_cycle
" _
& "cycle_time, crew_size) Values (" _
& [txtInternalPartTool] & ", " _
& [txtNumberCavities] & ", " _
& [txtCycleTime] & ", " _
& [txtNumberOperators] & ")"
Exit_cmdSaveRecord_Click:
Exit Sub
Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click
End Sub
When i click on the Save Record command button on my form, i get the
following error: "Compile Error. Userdefined type not defined." and the "Dim
MyDB as DAO.Database line is highlighted. how do i define MyDB as a
Database, or is this problem being generated from something else.
I am using Access 2000 and i have three tables that are all linked together
on a particular field. I altered the following code from someone else's post
(as far as the MyDB.execute parts go).
Private Sub cmdSaveRecord_Click()
On Error GoTo Err_cmdSaveRecord_Click
Dim MyDB As DAO.Database
Set MyDB = CurrentDb
MyDB.Execute "Insert Into DBA_cs_part_profile_vw1 (Part, " _
& "Customer_Part) Values (" _
& [txtInternalPartNumber] & ", " _
& [txtExternalPartNumber] & ")"
MyDB.Execute "Insert Into DBA_part_machine_tool1 (Part, Machine " _
& "Tool) Values (" _
& [txtInternalPartMachine1] & ", " _
& [txtMachine] & ", " _
& [txtToolNumber] & ")"
MyDB.Execute "Insert Into DBA_part_machine1 (Part, parts_per_cycle
" _
& "cycle_time, crew_size) Values (" _
& [txtInternalPartTool] & ", " _
& [txtNumberCavities] & ", " _
& [txtCycleTime] & ", " _
& [txtNumberOperators] & ")"
Exit_cmdSaveRecord_Click:
Exit Sub
Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click
End Sub
When i click on the Save Record command button on my form, i get the
following error: "Compile Error. Userdefined type not defined." and the "Dim
MyDB as DAO.Database line is highlighted. how do i define MyDB as a
Database, or is this problem being generated from something else.