Whats wrong with this code. Blocks

mousemat

Completely Self Taught
Local time
Today, 03:40
Joined
Nov 25, 2002
Messages
233
Hi there

Have been working for a while on this part of code. Basically beause of the way this clients database is written i have to do many workrounds.

This one is stumping me. The idea is simple. If the search text box is empty, the first message comes up. This works.

If the search text box has a number that is not in the system, by way of a query displayed on subform, the second message pops up, this works, however,as soon as i press OK, it displays the first message again. How can I stop it from displaying the first message after the second.

Public Sub SearchCore()
On Error GoTo Err_nocore_Exit

Const conErrNotInList = 2427

If Search = "" Then
MsgBox "You did not enter a Core Number, Please Re-Enter!", vbOKOnly, "ERROR"
Search.SetFocus
Else
Forms!SearchCores![Search Core List].Requery
DoCmd.CancelEvent



If [Search Core List].Form![CopyCoreNo] = Null Then

Err_nocore_Exit:
If Err.Number = conErrNotInList Then
MsgBox "This core has either been broken, or does not exist in the database.", vbOKOnly, "CORE NOT FOUND"


Search = ""
Search.SetFocus
DoCmd.CancelEvent
'Else
Forms!SearchCores![Search Core List].Requery

End If

End If
End If



End Sub
 
Code:
If [Search Core List].Form![CopyCoreNo] = Null Then

that part should be

Code:
if is null([Search Core List].Form![CopyCoreNo]) then
 
Hi Max

I have tried that bit of code, hower, it doesn't bring up the second message box.

I need to bring up the 2nd message box when the field is null so that the employees know that the core does not exist.
 
I have solved the problem, there was nothing wrong with the code at all.

I noticed that it was also being referenced by the 'After Update@ property of the text box.

Bloody clients who think they an create access db's
 

Users who are viewing this thread

Back
Top Bottom