473,732 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

USing wildcard searchs in Infopath using VB

2 New Member
Hi Everyone,

I am new to this forum and am i dire need of some help. I am trying to use wildcard searches in infopath. I have it connected to an access database using data connection.

I have some code which will allow me to do it but i dont know how to change the code. Could someone please help me. I have added the code for you to.

function MyQuery::OnClic k(eventObj)
{
// Get the default SQL command for the form.
var strOrigSQLComma nd = XDocument.Query Adapter.Command ;

// Get the query node that you want to modify.
var querySuppliers = XDocument.DOM.s electSingleNode (
"/dfs:myFields/dfs:queryFields/q:Suppliers");

// Obtain the text that was entered for the wildcard character search, and then clear
// the current query parameter so that InfoPath will leave the current query parameter blank.
var strTitle = querySuppliers. selectSingleNod e("@ContactTitl e").text;
querySuppliers. selectSingleNod e("@ContactTitl e").text = "";

// Ask InfoPath to construct an SQL command that is based on all other field values.
var strMySQLCommand = XDocument.Query Adapter.BuildSQ LFromXMLNodes(q uerySuppliers);

// Save each of the other query items, and then clear the other query items before the next query.
var strSupplierID = querySuppliers. selectSingleNod e("@SupplierID" ).text;
querySuppliers. selectSingleNod e("@SupplierID" ).text = "";
var strContactName = querySuppliers. selectSingleNod e("@ContactName ").text;
querySuppliers. selectSingleNod e("@ContactName ").text = "";
var strPhone = querySuppliers. selectSingleNod e("@Phone").tex t;
querySuppliers. selectSingleNod e("@Phone").tex t = "";

// Add ContactTitle to the query so
// that ContactTitle can support wildcard characters.
if (strTitle != "")
{
if (strMySQLComman d != "")
strMySQLCommand = strMySQLCommand + " AND ";

strMySQLCommand = strMySQLCommand +
"([Suppliers].[ContactTitle] LIKE \"" + strTitle + "\")";
}

// Construct the full query string.
var strSQLQuery = strOrigSQLComma nd;
if (strMySQLComman d != "")
strSQLQuery = strSQLQuery + " WHERE " + strMySQLCommand ;

// This is the query.
//XDocument.UI.Al ert(strSQLQuery );

// Run the query.
XDocument.Query Adapter.Command = strSQLQuery;
XDocument.Query ();

// Restore all the user entries to the Query fields so that the user entries will
// be available if you want to modify and to rerun the query.
querySuppliers. selectSingleNod e("@SupplierID" ).text = strSupplierID;
querySuppliers. selectSingleNod e("@ContactName ").text = strContactName;
querySuppliers. selectSingleNod e("@ContactTitl e").text = strTitle;
querySuppliers. selectSingleNod e("@Phone").tex t = strPhone;

// Restore the default table command (for the next time).
XDocument.Query Adapter.Command = strOrigSQLComma nd;

// Switch to data entry view to see results.
XDocument.View. SwitchView("Dat a Entry");

}
Oct 16 '08 #1
0 2668

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

Similar topics

0
2431
by: Victor Hadianto | last post by:
Hi all, Based on this post: http://groups.google.com/groups?q=mso-application&hl=en&lr=&selm=6n%23mkFJREHA.3744%40cpmsftngxa10.phx.gbl&rnum=8 And by doing a bit of reverse engineering how InfoPath is doing it I manage to make my XML files opened in my App instead of the default XML editor by adding the <?mso-application progid="My.App"?>
4
2432
by: Jon Westmore | last post by:
I'm using an ASP page to dynamically generate an XML document using a data source. I was thinking the concept would be similar to dynamically creating HTML but I'm running into an issue. Here is my source code: <%Response.ContentType = "text/xml" Response.CharSet="" Dim Connect ,RS, Query, Details Details = Trim(Request("Details"))
3
1391
by: Jon Westmore | last post by:
I've been trying to use a combination of ASP and Infopath to display a dynamic form for users to fill out. I have some ASP code that generates a dynamic XML document and the document points to the Infopath application to display the output. However, Internet Explorer is making slight modifications to the output and its keeping Infopath from launching so that the document can be viewed. In my code, the first XML tag generated is typed...
4
2217
by: MJ | last post by:
A question for InfoPath and ASP.NET experts: What do you think about the future of InfoPath and ASP.NET WebForms? Is InfoPath 12 going to replace ASP.NET WebForms? If not, in which types of applications would ASP.NET WebForms be more appropriate than InfoPath and vice versa? I very much appreciate your response! Best regards, Mike Johnson
0
1245
by: Cosimo Galasso | last post by:
I'm building a aspx web page with a button control. When the button is clicked the server build an xml string containg the directive to be opened with infopath. When the client receive the file an error occured. The strange is that if a save the file locally, open with notepad and save it again without any modification, the file is correctlu opened with infopath. Any suggestion?
10
6726
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that contains only tables. I have linked the tables for the front end to the back end database. I am trying to set the recordsource of a form to a query established by the user to narrow the scope but I don't want to display the form if there are no...
0
3944
by: Sebastian Gingter | last post by:
I have an infopath XML file and want to use XPath queries with the XmlDocument object. The Problem: Every (in my eyes correct) XPath query does return a NULL object. Example: XmlDocument doc = new XmlDocument(); doc.Load(fileName); XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
0
2736
by: =?Utf-8?B?Q2hhcmxlcyBTaW1wc29u?= | last post by:
Hello I've tried in the InfoPath groups but no luck yet. Here is my situation: All computers are on an Active Directory domain in the company. I have an Infopath form stored on the network (in SharePoint) that needs to be able to update a SharePoint list when a button is clicked. I got the sample code from a book called "Developing Solutions with Microsoft InfoPath".
0
1666
by: Anni | last post by:
Hi, Can anyone please tell me how do I give same namespace for different infopath forms.? I have an XML formed by an infopath form, the XML is : <?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:PublishedDiagnosticTests:-myXSD-2008-06-13T05-43-58" solutionVersion="1.0.0.75" productVersion="12.0.0.0" PIVersion="1.0.0.0" href="http://sharepointqtc:8558/formservertemplates/PublishedDiagnosticTests.xsn"?> <?mso-application...
0
8946
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9447
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9307
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9235
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6735
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.