473,395 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Display message when records not found

Hi,

I need to display a message " NO EMPLOYEES TO REPORT" after the Top Title in a SQLPLUS report when no rows are retrieved by a select statement.
So how do i go about?

Regards,
Nithasha.
May 12 '06 #1
1 2391
See Nitasha will this helps to you.
what i does make the connection fired 2 qrys count(*) and select * if found then i get the no. of record found in the rcrdfound variable as shown below and if rcrdfound>0 means i got 1 record atleast else i display record not found message, ignore rest of the things as this is related to my form.



Public Function func_findplcno(theplcno As String) As Integer
Set con = New ADODB.Connection
con.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\database\licdb.mdb;" & _
"Uid=Admin;Pwd=tingtong;"
Set recset = New ADODB.Recordset
recset.Open "Select count(*) from Main where plcno='" & theplcno & "';", con, adOpenDynamic, adLockOptimistic, adCmdText
rcrdfound = recset.Fields(0)
recset.Close
recset.Open "Select * from Main where plcno='" & theplcno & "';", con, adOpenDynamic, adLockOptimistic, adCmdText

If rcrdfound > 0 Then
' if found then iam going to display that record


txttbltrm.Text = dbStr$(recset("tbltrm"))
txtmtdt.Text = dbStr$(recset("mtdt"))
cmbmode.Text = dbStr$(recset("mode"))
txtdob.Text = dbStr$(recset("dob"))
txtplcno.Text = dbStr$(recset("plcno"))
txtprmm.Text = dbStr$(recset("prmm"))
txtsmasrd.Text = dbStr$(recset("smasrd"))
txtname.Text = dbStr$(recset("name"))
txtfname.Text = dbStr$(recset("fname"))
txtcoadrs.Text = dbStr$(recset("coadrs"))
txtemail.Text = dbStr$(recset("email"))
txtmobl.Text = dbStr$(recset("mobl"))
txtteloff.Text = dbStr$(recset("teloff"))
txttelres.Text = dbStr$(recset("telres"))
txtptadrs.Text = dbStr$(recset("ptadrs"))
txtocptn.Text = dbStr$(recset("ocptn"))
txtpost.Text = dbStr$(recset("post"))
txtnmemplyr.Text = dbStr$(recset("nmemplyr"))
txtlosrvc.Text = dbStr$(recset("losrvc"))
txtnomnm.Text = dbStr$(recset("nomnm"))
txtrltn.Text = dbStr$(recset("rltn"))
txtage.Text = dbStr$(recset("age"))
txtdudt.Text = dbStr$(recset("dudt"))
txtpmtdt.Text = dbStr$(recset("pmtdt"))
txtcomsn.Text = dbStr$(recset("comsn"))


' Form1.txttbltrm.SetFocus
Form1.ForeColor = &HFF
Form1.Caption = "Well here you are make the changes you desire (Be cautious in dates!)" & _
"and don't forget to press 'Update' to save the changes done."
Set con = Nothing
Set recset = Nothing
func_findplcno = 1

Else
' if not found then iam going to display this message

MsgBox "Policy No. You entered was Not Found!", vbExclamation, "Check Policy Number"
get_plcno.Text1.SetFocus
func_findplcno = 0
End If
End Function
Nov 3 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dave | last post by:
Hi I m facing strange problem... I have one field char type data length 1.. It has data either 1 or 2 in all the field tht I have checked through enterprise manager. I'm running query "select...
3
by: SJM | last post by:
I have a problem that occurs occasionally with a db for a undetermined reason which I would love to solve. I construct and append a series of 7 records to a table using ADO recordset. Each record...
9
by: Sandy | last post by:
Hi all, I have a form to list records (frmListIssue) which I call from different other forms. My wish is to display a message when the form is called and empty; no records to display. I want to...
17
by: perryche | last post by:
I have 5records, e.g. Rc1, Rc2, Rc3..., when user open up a form, I want it to open to a particular record (say Rc3) then when user chooses the Record Selector , it will go to Rc2 and , it will go...
1
by: Duppypog | last post by:
I have an asp.net page using a repeater control to display a dataset. When the dataset returned is null (no records matched the criteria) I want to display a message to the effect "No matching...
5
by: Miguel Dias Moura | last post by:
Hello, I have a search form in an ASP.NET/VB page. The form has the input text box and the button "search". The keywords are passed in the URL to results.aspx. Here is an example:...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
1
by: Kim | last post by:
How can I display "No data found" in the repeater if there are no records found after selecting an item from a dropdown list. Another question is: Can repeater perform paging as in datagrid if...
1
by: Ky_fanatic | last post by:
I am working on an application which returns data from multiple databases. The user enters a pallet ticket and it goes out to the multiple db's and returns data which meets the criteria. My...
22
by: onyris | last post by:
Hi guys - one more problem i couldn't figure it out . I have a form which displays a set of records and i want to display on top of the form the number of the record the user is looking at out of...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.