I have a form with a subform on it.
Recently I added a new table in my subform query because it needs to update the record in one of this particular field when it is edited.
For some records, when it is edited, no duplication occured.
And some, when that particular field is edited, it automatically makes a duplicate.
Some records were duplicated 5 times, some 17 times and some 24 times.
There is a combobox that is already there for a long time and it will filter the subform according to the measuring equipment group.
So I just added the code (in Bold) so that it is compatible with the new query that I have added.
I don't know whether the codes are wrong or maybe there's something wrong with the query.
See screenshots for reference.
In photo Query Form Messung-4, the blue box indicate no duplication and red box are duplicates.
Recently I added a new table in my subform query because it needs to update the record in one of this particular field when it is edited.
For some records, when it is edited, no duplication occured.
And some, when that particular field is edited, it automatically makes a duplicate.
Some records were duplicated 5 times, some 17 times and some 24 times.
There is a combobox that is already there for a long time and it will filter the subform according to the measuring equipment group.
So I just added the code (in Bold) so that it is compatible with the new query that I have added.
Code:
Private Sub cboGruppe_AfterUpdate()
sfmMessung.Form.RecordSource = "SELECT tblMessauftrag.*, tblFOLand.txtLand, tblBauphasen.txtBauphase,
tblPulk.txtBezeichnung, tblMessaufgaben.txtMessaufgabe,
tblPrioritaet.txtBezeichnung,
qryStammdatenBelegung.*,
[txtFahrzeugtyp] & ' - ' & [qryStammdatenBelegung].[txtBezeichnung] AS Ausdr1,
qryBelegungPerson.tblMesstechniker.txtAnzeige,
qryBelegungPerson.tblBemusterer.txtAnzeige, [B][COLOR="Red"]
IIf(IsNull([indAbweichendeMessanlage]),[tblMesstechniker].[txtAnzeige],[qryMessauftragPerson].[txtAnzeige]) AS Ausdr2 [/COLOR][/B]" & _
"FROM (tblMessanlage
[B][COLOR="red"]LEFT JOIN qryMessauftragPerson
ON tblMessanlage.ID = qryMessauftragPerson.ID[/COLOR][/B])
RIGHT JOIN (tblMessaufgaben
RIGHT JOIN (tblFOLand
INNER JOIN (tblPrioritaet RIGHT JOIN (tblPulk
RIGHT JOIN ((tblBauphasen
RIGHT JOIN (qryStammdatenBelegung
INNER JOIN tblMessauftrag
ON (qryStammdatenBelegung.indFOLand = tblMessauftrag.indFOLand)
AND (qryStammdatenBelegung.txtTeilesachnummer = tblMessauftrag.txtTeilesachnummer))
ON tblBauphasen.lngReihenfolge = tblMessauftrag.indBauphase)
INNER JOIN qryBelegungPerson
ON (tblMessauftrag.indFOLand = qryBelegungPerson.indFOLand)
AND (tblMessauftrag.txtTeilesachnummer = qryBelegungPerson.txtTeilesachnummer))
ON tblPulk.ID = tblMessauftrag.indPulk)
ON tblPrioritaet.ID = tblMessauftrag.indPrioritaet)
ON tblFOLand.ID = tblMessauftrag.indFOLand)
ON tblMessaufgaben.ID = tblMessauftrag.indMessaufgabe)
ON tblMessanlage.ID = tblMessauftrag.indAbweichendeMessanlage " & _
"WHERE (Not tblMessauftrag.datEinarbeitIst Is Null Or Not tblMessauftrag.datMessungSoll Is Null)
And (tblMessauftrag.datMessungIst Is Null) "
& IIf(cboGruppe.value <> 0, "
AND (IIf([tblMessanlage].[lngGruppe] Is Null,
[qrystammdatenbelegung].[lngGruppe],
[tblMessanlage].[lngGruppe]) = " & cboGruppe.value & ") ", "") & _
"ORDER BY tblMessauftrag.lngMessauftragNr;"
End Sub
I don't know whether the codes are wrong or maybe there's something wrong with the query.
See screenshots for reference.
In photo Query Form Messung-4, the blue box indicate no duplication and red box are duplicates.