16. februar 2016 - 09:45Der er
15 kommentarer og 1 løsning
Msgbox before update
Hej
Jeg prøver at lave en popup box i en formular, der skal komme hvis, der bliver tastet en allerede eksisterende post, og et afkrydsningsfelt er markeret.
Private Sub Batch_BeforeUpdate(Cancel As Integer)
IF (Batchnr = Batchnr) and (LockBatch = yes) MsgBox ("Batch are locked") Cancel = True End If
End Sub
Er der nogen der kan hjælpe mig ?
Hvis der indtastes et batchnr, der allerede eksistere og denne batch er låst, skal der komme en popup.
Du har ret Der skal indtastes et batchnr, og derefter checkes om både batchnr allerede eksistere og om batch er låst ved hjælp af et afkrysnings felt, før formular opdatere tabel.
Hi Terry Barchnr have both letter and numbers, i tried to use your programming, but the message: Run-time error '438' Object doesnt support this property or method.
I've just made a simple example and this works. If your fields are the same as you show in example then all you need to change is tbl1 (table name) to the correct tabl ename.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DCount("*", "tbl1", "Batchnr = '" & Me.Batchnr & "' And LockBatch = True") > 0 Then
Not sure what you are hoping to do with the above code, but I'm guessing the error is because you have swapped the "') around, it should be '")
If you get the code to run without errors all it will do is count records where BatchLock = True but not necessarily with same Batchnr as your entering.
But maybe I haven't been given all the information.
after a bit of confusion as to how to use the dB and which sub form the code has to be on it seems its now working as per the solution I gave Skrevet ons. d. 17. februar 2016 kl. 12:00:57| #11
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.