473,378 Members | 1,078 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,378 software developers and data experts.

How to send messagebox if item is not listed in data and exit?

anoble1
245 128KB
I am having a hard time for some reason. I have a search textbox with a button to search. Right now if you put some bogus number in there is returns a value that is not the correct value. Works fine if you type in the correct value though.
Anyway how do you say if the value you entered is not the records then Exit Sub and send messagbox? And do you put that at the very end of the IF statement?

Here is what I have that is not working.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdFind_Click()
  2. On Error GoTo errHandle
  3. Dim records As Recordset
  4.     If Nz(txtPOSearch.value, "") = "" Then
  5.         Forms!frmMain!frmAll.Form.Filter = "tblInformation.PO = 0"
  6.         Forms!frmMain!frmAll.Form.FilterOn = True
  7.  
  8.     ElseIf records.EOF Then Exit Sub
  9.  
  10.  
  11.     Else
  12.         'If Not Me.Recordset.EOF Then Exit Sub
  13.         Forms!frmMain!frmAll.Form.Filter = "tblInformation.PO = " & txtPOSearch.value
  14.         Forms!frmMain!frmAll.Form.FilterOn = True
  15.     End If
  16.  
  17.     Exit Sub
Sep 28 '17 #1

✓ answered by NeoPa

Certainly a hard time explaining your problem clearly. Can I assume you have a SubForm called frmAll and you want to see if there are any records on it? Also, that you want the SubForm to reflect filtering based on some field that isn't clear matching the value from a control on your main form?

If so, then general principles as working with very little info :
  1. Build the form with a SubForm linked on the main form's control (called [txtPOSearch] I suspect).
  2. Check the .Recordset.RecordCount of the SubForm to see if it's greater than zero (0).

1 1321
NeoPa
32,556 Expert Mod 16PB
Certainly a hard time explaining your problem clearly. Can I assume you have a SubForm called frmAll and you want to see if there are any records on it? Also, that you want the SubForm to reflect filtering based on some field that isn't clear matching the value from a control on your main form?

If so, then general principles as working with very little info :
  1. Build the form with a SubForm linked on the main form's control (called [txtPOSearch] I suspect).
  2. Check the .Recordset.RecordCount of the SubForm to see if it's greater than zero (0).
Sep 28 '17 #2

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

Similar topics

0
by: arti | last post by:
Hi all. I have a problem/question with XForms. I have 2 instnace in my document, instance1 and instance2. <xforms:instance xmlns="" id=instance1"> .... </xforms:instance> <xforms:instance...
4
by: zhimin | last post by:
Hi, I'm writing a program to send large file(100m) through dotnet using TCPListener & TCPClient, I'm sending the file with a ask and response loop: 1. Client send a flag 1 to server indicate it...
3
by: JD | last post by:
Hi -- I've scanned a ton of google results and am sort of confused by all the different objects that can be used for this. Here's what I need to do (fairly simple) -- Construct an xml object in...
2
by: D. Shane Fowlkes | last post by:
I'm using ASP.NET (VB) and I'm pretty new to .NET and using Templates. I have a SqlDataReader which is bound to a Repeater. The Repeater contains a table and for each record, it'll write a...
1
by: lydia sista via DotNetMonster.com | last post by:
hi! help... How do you show/hide item's data? Like sale item on product catalogue. I want to show the sale image when the status of product is on sale. in my catalogue I use datalist:...
4
by: Evan | last post by:
I have a data bound combo box. The combo box displays several items (status code descriptions). After the combo box is bound, I want to set the combo box so that the "Draft" status is displayed by...
3
by: atzhuqj | last post by:
These days I'm working with a web project.I use asp.net 2.0 callBack to refresh the web page without postback,but I found the client have to send a lot of data to server,that is not so EFFICIENT...
4
by: Gunnar G | last post by:
How can I send a lot of data from foo.php to bar.php ? This might happen if foo.php echo some text and bar.php returns an image that should be displayed below the text that was echo:ed, and...
3
by: sandipcd | last post by:
After customer filling the form, the form data will be send to mysql, and an email will sent to me with the last form data that customer submitted. All is working, but only the problem is in the...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.