Rather than setting it to "", just set to something that is not going to
return any records. I assume this would work if LocationID is required
in the child record...
"SELECT [LocationProgram].[locationID], [LocationProgram].[programID] "
_
& " FROM LocationProgram WHERE locationID Is Null"
--
Paul Overway
Logico Solutions
http://www.logico-solutions.com
there is no linkage on the form...the data in the subform is
dynamically populated in the on_current event.....
When the cursor falls into the 'new record' territory due to a delete
on the last record in the cursor set I need to
set the subform recordset to "" so it does not show the child-data from
the deleted record...
I can't do that because of the error Access is giving me...((
How is cfProgram linked to the parent, if at all? Is locationID your
primary key for the parent? Is it a required field in the record?
In any case, you probably need to test for newrecord, i.e.,
If Me.NewRecord =False Then
If Not IsNull(Me!locationID) Then
'Enable subform and set recordsource
Else
'Disable subform...and set recordsource to return no records
End if
Else
'Disable subform...and set recordsource to return no records
End if
--
Paul Overway
Logico Solutions
http://www.logico-solutions.com
...appreciate your efforts Paul ))
recordset is set to a SQL statement...
If Not IsNull(Me!locationID) Then
mvlocationID = removeGuid(StringFromGUID(Me!txtLocationID))
Me.cfProgram.Enabled = True
Me.cfProgram.Form.RecordSource = "SELECT
[LocationProgram].[locationID], [LocationProgram].[programID] " _
& " FROM LocationProgram WHERE locationID = " & "'" &
removeGuid(StringFromGUID(Me!txtLocationID)) & "';"
Call synchWithCRM
Else
Me.cfProgram.Form.RecordSource = ""
Me.cfProgram.Enabled = False
End If
message What are you setting the recordsource to when the parent is NOT on
newrecord? Also, how are the forms linked, if at all, i.e., how is
the Master/Child link property set?
--
Paul Overway
Logico Solutions
http://www.logico-solutions.com
The following sets the subform recordset to nothing and works when
the parent is on an existing record but fails when the parent is on
a new record - which happens after the last record is deleted:
Me.cfProgram.Form.RecordSource = ""
Any ideas why this fails?