F
FP1
I'm trying to sync a form/subform where they are based on a common
key (Appid). The situation is I want users to be able to add records
to the Form table, but only if a corresponding record (Appid) exists
in the child window. (I do a query to only those records which do not
exist in the table to be editted.) This the 'current' attempt.
Either the child window says EOF=FALSE when it's NOT, I get absolute
position of -1 when it's NOT, or Bookmark not accessible when I tried
to use that. There MUST be a way to do this. ALL afternoon on this.
Good ole convoluted Access. What am I doing wrong here? This is the
Before_update code. (The child table, I should point out, is not
updateable on the form) Thanks!
Dim appid
Dim strCriteria
Dim rsMe As DAO.Recordset
Dim rsChild As DAO.Recordset
Dim cForm As Form
' if we're adding a new record, make sure a record with that key
doesn't already exist
' in the local table. If it does, no can do
Set cForm = Me.chdPatCountryApp.Form 'child form with master
records
Set rsMe = Me.Recordset
Set rsChild = cForm.Recordset
Dim updateAllowed As Boolean
updateAllowed = True
If cForm.Recordset.AbsolutePosition < 0 Then
updateAllowed = False
End If
If Not updateAllowed Then
Cancel = True
Me.Undo
Exit Sub
End If
If IsNull(txtAppId.Value) Then
appid = cForm("appid")
Me("tblFP_PatCountryApplication.appid") = appid
End If
Me("caseNumber") = cForm("caseNumber")
If Me.NewRecord Then
Me("appid") = cForm("appid")
RecordAdded = True
Else
RecordAdded = False
End If
End Sub
key (Appid). The situation is I want users to be able to add records
to the Form table, but only if a corresponding record (Appid) exists
in the child window. (I do a query to only those records which do not
exist in the table to be editted.) This the 'current' attempt.
Either the child window says EOF=FALSE when it's NOT, I get absolute
position of -1 when it's NOT, or Bookmark not accessible when I tried
to use that. There MUST be a way to do this. ALL afternoon on this.
Good ole convoluted Access. What am I doing wrong here? This is the
Before_update code. (The child table, I should point out, is not
updateable on the form) Thanks!
Dim appid
Dim strCriteria
Dim rsMe As DAO.Recordset
Dim rsChild As DAO.Recordset
Dim cForm As Form
' if we're adding a new record, make sure a record with that key
doesn't already exist
' in the local table. If it does, no can do
Set cForm = Me.chdPatCountryApp.Form 'child form with master
records
Set rsMe = Me.Recordset
Set rsChild = cForm.Recordset
Dim updateAllowed As Boolean
updateAllowed = True
If cForm.Recordset.AbsolutePosition < 0 Then
updateAllowed = False
End If
If Not updateAllowed Then
Cancel = True
Me.Undo
Exit Sub
End If
If IsNull(txtAppId.Value) Then
appid = cForm("appid")
Me("tblFP_PatCountryApplication.appid") = appid
End If
Me("caseNumber") = cForm("caseNumber")
If Me.NewRecord Then
Me("appid") = cForm("appid")
RecordAdded = True
Else
RecordAdded = False
End If
End Sub