Hello,
I have a database where I store products and every unit with its serial number.
I am trying to create a system for repairs evidence.
The idea is that I enter the serial number into one combo box and the product name appears in another one. I have the exact same functionality working well and I copied it. That's why I got confused because it's working well in one application and it doesn't work properly in another one.
This is the data entry form for adding new orders where it works like I want to:
When serial number is updated, this VBA code runs:
Code:
If DCount("[SerialNumber]", "qryTransakceALL", "[SerialNumber] = [cboSerialNumber]") > 0 Then
ProduktID = DLookup("[PKProduktID]", "qryTransakceALL", "[SerialNumber] = [cboSerialNumber]")
cboFKProduktID.Value = ProduktID
txtCena.SetFocus
End If
It's working well.
The repair system is different because the product name isn't stored in the corresponding table. I just want to display it as an additional information. I tried this:
Code:
If DCount("[PKDetailObjednavkyID]", "qryTransakceALL", "[PKDetailObjednavkyID] = [cboSerialNumber]") > 0 Then
ProductName = DLookup("[PKProduktID]", "qryTransakceALL", "[PKDetailObjednavkyID] = [cboSerialNumber]")
Me.cboProductName.Value = ProductName
txtNakladyNaOpravu.SetFocus
Else
MsgBox ("Zadané výrobní číslo neexistuje.")
Me.Undo
End If
The problem is that when I change one serial number, all the product names fields in the continuous form get changed, now just the record that I want.
Like in these pictures... I only changed the first serial number but it changed all the product types in all the records.
Any ideas why?
Thank you,
Tomas