Ctreate MsgBox??

swedish_mania

Registered User.
Local time
Today, 04:03
Joined
Feb 8, 2005
Messages
43
Create MsgBox??

I have a select query to search for a client. A box pops up and you enter the name, if the name is there, then that record is displayed.

Now if i enter a name that isnt there, then i get a blank table - which is fair enough.

I want to create a msgbox that pops up to let a user know the name they typed isnt in the db.

For example, "This Client Doesn't Exist - Please Try Again..".

How do i do that? :confused:
 
Last edited:
use the syntax:

msgbox("This Client Doesn't Exist - Please Try Again")
 
If your query is displayed as a subform on a main form, You could use something like this :

If childFoundQuote.Form.RecordsetClone.RecordCount = 0 Then
MsgBox "No Records Returned"
End If

"childFoundQuote" is the name of the subform window.
 
I have a command button, which runs the query.

I want it to display a message if no records are found.

Nikki - Your suggestion creates a msgbox, but before i have chance to enter any text, i want that box to appear afterwards if nothing is found.

Gizmo - Couldnt get that to work..
 
Last edited:
did you change "childFoundQuote" to the name of your subform window ?
 
The sub form window is Form1 at the moment, changed the name and it didnt work.
 
So if the subform window name is Form1, what is the name of the actual form?

and which version of access are you using?


The code I have provided was copied straight out of a working DB .
 
I have two forms, one is called Bookings and the other is Customer - Not sure what you mean by sub form. :confused: Heres the codes i have behind the button -->

Private Sub Customer_Click()
On Error GoTo Err_Customer_Click

Dim stDocName As String

stDocName = "Customer Search"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Customer_Click:
Exit Sub

Err_Customer_Click:
MsgBox Err.Description
Resume Exit_Customer_Click

End Sub


Private Sub Customer_Click()

If Customer.Form.RecordsetClone.RecordCount = 0 Then
MsgBox ("This Client Doesn't Exist - Please Try Again")

End If

End Sub

Thanks in advance...
 

Users who are viewing this thread

Back
Top Bottom