J
JKarchner
I will do my best to describe the situation as best as I can, and if you need
further clarification please let me know. Also, i do know that there is a
problem with normalization in this DB.
Now my situation: I have two subforms on a main form. Currently i have it
so that when data is entered in subformA that record is copied to
subFrmWQryWindows(New). What i would like to do is have it so that if i
update the information in subformA it will also be updated in
subFrmWQryWindows(New). I would assume that for what i want it needs to be
placed into the BeforeUpdate section.
My code is listed below for the inserting function:
Private Sub Form_AfterInsert()
If ((Me.SupplyPartCategory = "Window") Or (Me.SupplyPart_ID = 56)) Then
Dim SQL As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
SQL = "SELECT Model_ID, SupplyPart_ID FROM qryWWindowsXREFModels WHERE
qryWWindowsXREFModels.Model_ID = " & Me.Model_ID & " AND
qryWWindowsXREFModels.SupplyPart_ID = " & Me.SupplyPart_ID & ";"
'Set rst = db.OpenRecordSet(SQL, dbOpenDynaset)
Set rst = db.OpenRecordset(SQL)
If rst.RecordCount = 0 Then
SQL = "INSERT INTO qryWWindowsXREFModels (Model_ID, SupplyPart_ID,
Supplier_ID, SupplySource_ID, SupplyPercent, SupplyNotes) VALUES (" &
Me.Model_ID & ", " & Me.SupplyPart_ID & ", " & Me.Supplier_ID & ", " &
Me.Supplier_Source & ", " & Me.SupplyPercent & ", '" & Me.SupplyNotes & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL SQL
DoCmd.SetWarnings True
Me.Parent.[subFrmWQryWindows(New)].Form.Requery
End If
End If
End Sub
Thank you in advance for any help you can provide!
further clarification please let me know. Also, i do know that there is a
problem with normalization in this DB.
Now my situation: I have two subforms on a main form. Currently i have it
so that when data is entered in subformA that record is copied to
subFrmWQryWindows(New). What i would like to do is have it so that if i
update the information in subformA it will also be updated in
subFrmWQryWindows(New). I would assume that for what i want it needs to be
placed into the BeforeUpdate section.
My code is listed below for the inserting function:
Private Sub Form_AfterInsert()
If ((Me.SupplyPartCategory = "Window") Or (Me.SupplyPart_ID = 56)) Then
Dim SQL As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
SQL = "SELECT Model_ID, SupplyPart_ID FROM qryWWindowsXREFModels WHERE
qryWWindowsXREFModels.Model_ID = " & Me.Model_ID & " AND
qryWWindowsXREFModels.SupplyPart_ID = " & Me.SupplyPart_ID & ";"
'Set rst = db.OpenRecordSet(SQL, dbOpenDynaset)
Set rst = db.OpenRecordset(SQL)
If rst.RecordCount = 0 Then
SQL = "INSERT INTO qryWWindowsXREFModels (Model_ID, SupplyPart_ID,
Supplier_ID, SupplySource_ID, SupplyPercent, SupplyNotes) VALUES (" &
Me.Model_ID & ", " & Me.SupplyPart_ID & ", " & Me.Supplier_ID & ", " &
Me.Supplier_Source & ", " & Me.SupplyPercent & ", '" & Me.SupplyNotes & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL SQL
DoCmd.SetWarnings True
Me.Parent.[subFrmWQryWindows(New)].Form.Requery
End If
End If
End Sub
Thank you in advance for any help you can provide!