Gentlemen,
I have a subform with a field step with the list box, three data fields and one text field.
how do I change a field in the listbox, delete all records of this record and all records below.
Thank you.
Gentlemen,
I have a subform with a field step with the list box, three data fields and one text field.
how do I change a field in the listbox, delete all records of this record and all records below.
Thank you.
The lack of replies would indicate that nobody understands the problem. Can you clarify, perhaps with an example of what the data looks like?
In general:
CurrentDb.Execute "DELETE * FROM TableName WHERE..."
The WHERE clause would have to identify the records to be deleted. If I'm seeing right, you'd want to match the CodProduto field and have > on the CodPassosStat field. Or perhaps the Data Programada field.
pbaldy, Thanks for helping.
My problem is in WHERE. By changing the field, I need to delete all "below" the changed record.
And also delete two values of two fields of the record being changed.
In the where clause I need to specify this, but I'm not getting.
Thank you.
How do you define "below", in terms of the data? I offered two thoughts, which you haven't addressed.
"below" are all records after the
changed record. (Picture3).
Sorry, this is because it became clear to me.
is a CodProduto for many steps (CodPassosStatus).
I need to specify only those records that are
further, beyond the field and DataProgramada
PontoFocal the record being changed.
So something along the lines of
CurrentDb.Execute "DELETE * FROM TableName WHERE CodProduto = " & Me.CodProduto & " And DataProgramada > #" & Format(Me.DataProgramada, "mm/dd/yy") & "#", dbFailOnError
and then requery the subform.
Thanks for helping.
Simply put the line of code you sent me
the event by changing the field. Step. (I modified the name of
table and the format to dd / mm / yyyy).
Excludes records as I wanted, just kept on each
Deleted the word field, and did not exclude the field and DAtaProgramada PontoFocal
the record was changed
(picture becomes clearer)
Thank you.
Thank you.![]()
It does not appear you requeried the subform, which will get rid of the deleted records.
Yes, sorry I forgot.
I used this:
Form_fFiltros.combProduto_AfterUpdate
but sometimes get an error.
How do I update only the subform?
I just have a problem, when the field of DataReprogramada steps
previous changes, and generated an auditor in another table.
With the SQL statement that does not work.
I do not understand why the records that will probably be deleted, never
will have the field DataReprogramada Filled.
Only the records prior to the record being changed.
I took referential integrity and work, but would like to maintain the integrity
reference.
Sometimes it is not excluded (images) see the third record in the Step field, I change the value but does not delete.
I need to delete the registry regardless of whether the date is higher or lower than today.
.![]()
Since your code is in the subform:
Me.Requery
As to what records are deleted, you need to specify in data terms, not visual terms, which records should be deleted. You can see I used date, but if that's not appropriate, what is?
Thanks for helping me.
Simply, I can not understand why time is not cleaning.
I can send the db?
You should be able to attach it here, after a compact/repair and zipping it.
sorry, this new version of the site's forum, I do not know where I choose to upload files.