473,471 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Display message when records not found

1 New Member
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 2392
nitinnkn
1 New Member
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: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.