Dlookup help needed

gastoman

Registered User.
Local time
Today, 20:13
Joined
Apr 19, 2004
Messages
14
I'm working on an RMA Database.
My problem is that I want to check if a RMA number is availible in the database. If so I can close this RMA. This works fine BUT now I also want to add the check if some felds are emty. If these felds are emty the RMA may not be closed.

I'm using the folowing code to check if the RMA number is availible in the database;
**code**

Private Sub Rma_Number_AfterUpdate()
If Nz(DLookup("[rma number]", "tblrma", "[rma Number] = '" & Screen.ActiveForm.Rma_Number & " )) = True Then
DoCmd.SetWarnings False
Dim stDocName As String

stDocName = "qryUpdatePutaway"
DoCmd.OpenQuery stDocName, acNormal, acEdit
MsgBox "Rma Closed"
'DoCmd.Save
'DoCmd.GoToRecord , , acNext
Forms("frmCloseRma").[Rma_Number].SetFocus
Else
MsgBox "RMA Number " & Rma_Number & " bestaat niet ! : ", vbCritical, "Duplicaat !!"
Forms("frmCloseRma").[Rma_Number].SetFocus
End If
End Sub

//code//

My question is how can I add the check if these fields are emty??
I would also like to have a msgbox if the RMA number is availible but the fields
are not emty.
Does anyone know how to make this work??

Martijn
 
Do a series of if statements to check ea box if you want a custom message for the user. Or you could just set the required property to true.

???
ken
 
Ok

Ok clear, but how do I implement this in my code??
I've tried sereral thing such as you second option but I couldn't get it to work. Can you please advice how to sove this??
 
I'm sure there are other ways, but:

In the event 'Before update' for the form, try something like:

**************
If isnull(me!mytextbox1) then
docmd.CancelEvent
exit sub
end if

If isnull(me!mytextbox2) then
docmd.CancelEvent
exit sub
end if

etc...
**************

???
ken
 
ok...

On my form I just have 1 field that's the field where I scan the rma number.
Afer the scan I check if the RMA number is in the dB, if so I run the Update Query so I can update more than one field at the same time.

It's possible that someone at another desk adds an discrapancy code to that RMA, if such a code is enterd I don't want users to be able to close the RMA.

As there are more than 400 RMA's per person per day that need to be closed I build the form like this so users just need to scan the RMA number and that de DB does the rest.
Hoop this makes things clear.

Martijn
 
Yes ok

Pat: Treu BUT this doesn't realy awnser my question How to build in an extra check that looks for non blanks in my db
 

Users who are viewing this thread

Back
Top Bottom