Dim rstAssemblies As Recordset
Dim lngCustomerID As Long
Dim strWhere As String
Dim lngAssemblyID As Long
Dim lngWDID As Long
If IsNull(Form_frmCustomerDetails.tblCustomersCustomerID) Then
MsgBox "Cannot create assembly for an empty customer record.", , "BAT Database"
Exit Sub
End If
lngCustomerID = Form_frmCustomerDetails.tblCustomersCustomerID
strWhere = "tblAssembliesCustomerID =" & lngCustomerID
Set rstAssemblies = CurrentDb.TableDefs("tblAssemblies").OpenRecordset
With rstAssemblies
.AddNew
.Fields!tblAssembliesCustomerID = lngCustomerID
.Fields!tblAssembliesSerNum = "New Record"
lngWDID = First_Assm(lngCustomerID)
If lngWDID > -1 Then
.Fields!tblAssembliesWaterDistrictID = First_Assm(lngCustomerID)
End If
.Update
.Bookmark = .LastModified
lngAssemblyID = .Fields!tblAssembliesAssemblyID
End With
Me.Requery
Form_frmCustomerList.Requery
DoCmd.OpenForm "frmAssemblyDetails", , , strWhere, , , lngAssemblyID
|