首页 \ 问答 \ 返回部分匹配值的记录(Returning records that partially match a value)

返回部分匹配值的记录(Returning records that partially match a value)

我正在尝试获取一个查询工作,它从表单控件获取值(有时只是字符串的第一部分)。 我遇到的问题是它只在输入完整字符串时才会返回记录。

即在姓氏框中,我应该能够输入gr,然后它就会显示出来

绿灰色的格雷厄姆

但是目前它并没有提供任何无用的完整搜索字符串。

有问题的表单上有4个搜索控件,只有在填写框时才会在查询中使用它们。

该查询是:

SELECT TabCustomers.*,
       TabCustomers.CustomerForname AS NameSearch,
       TabCustomers.CustomerSurname AS SurnameSearch,
       TabCustomers.CustomerDOB AS DOBSearch,
       TabCustomers.CustomerID AS MemberSearch
FROM TabCustomers
WHERE IIf([Forms]![FrmSearchCustomer]![SearchMember] Is Null
          ,True
          ,[Forms]![FrmSearchCustomer]![SearchMember]=[customerid])=True
      AND IIf([Forms]![FrmSearchCustomer].[SearchFore] Is Null
              ,True
              ,[Forms]![FrmSearchCustomer]![SearchFore] Like [customerforname] & "*")=True
      AND IIf([Forms]![FrmSearchCustomer]![SearchLast] Is Null
              ,True
              ,[Forms]![FrmSearchCustomer]![SearchLast] Like [customersurname] & "*")=True
      AND IIf([Forms]![FrmSearchCustomer]![Searchdate] Is Null
              ,True
              ,[Forms]![FrmSearchCustomer]![Searchdate] Like [customerDOB] & "*")=True;

I'm trying to get a query working that takes the values (sometimes just the first part of a string) from a form control. The problem I have is that it only returns records when the full string is typed in.

i.e. in the surname box, I should be able to type gr, and it brings up

green grey graham

but at present it's not bringing up anything uless the full search string is used.

There are 4 search controls on the form in question, and they are only used in the query if the box is filled in.

The query is :

SELECT TabCustomers.*,
       TabCustomers.CustomerForname AS NameSearch,
       TabCustomers.CustomerSurname AS SurnameSearch,
       TabCustomers.CustomerDOB AS DOBSearch,
       TabCustomers.CustomerID AS MemberSearch
FROM TabCustomers
WHERE IIf([Forms]![FrmSearchCustomer]![SearchMember] Is Null
          ,True
          ,[Forms]![FrmSearchCustomer]![SearchMember]=[customerid])=True
      AND IIf([Forms]![FrmSearchCustomer].[SearchFore] Is Null
              ,True
              ,[Forms]![FrmSearchCustomer]![SearchFore] Like [customerforname] & "*")=True
      AND IIf([Forms]![FrmSearchCustomer]![SearchLast] Is Null
              ,True
              ,[Forms]![FrmSearchCustomer]![SearchLast] Like [customersurname] & "*")=True
      AND IIf([Forms]![FrmSearchCustomer]![Searchdate] Is Null
              ,True
              ,[Forms]![FrmSearchCustomer]![Searchdate] Like [customerDOB] & "*")=True;

原文:https://stackoverflow.com/questions/223627
更新时间:2023-06-25 11:06

最满意答案

你无法使用这样的对象,你必须做这样的事情;

 var width = height = 280; // store values
 var option = jQuery.extend({
        parent: this,
        width:  width,
        height: height

        circle: {
            x:          (width / 2) + 5,   // option doesn't exist
            y:          (height / 2) + 22, // option doesn't exist
            radius:     70,
            speed:      5,
            rotation:   0,
            angleStart: 270,
            angleEnd:   90,
            hue:        220,
            thickness:  15,
            blur:       20
        }
    }, options);
 // option is now created and exists here

你可以这样做

var tempOption = {
    parent: this,
    width:  280,
    height: 280
};


tempOption.circle = {
    x:          (tempOption.width / 2) + 5,   // option doesn't exist
    y:          (tempOption.height / 2) + 22, // option doesn't exist
    speed:      5,
    rotation:   0,
    angleStart: 270,
    angleEnd:   90,
    hue:        220,
    thickness:  15,
    blur:       20
};


var option = jQuery.extend(tempOption, options);

You cannot work with object like that, you'll have to do something like this;

 var width = height = 280; // store values
 var option = jQuery.extend({
        parent: this,
        width:  width,
        height: height

        circle: {
            x:          (width / 2) + 5,   // option doesn't exist
            y:          (height / 2) + 22, // option doesn't exist
            radius:     70,
            speed:      5,
            rotation:   0,
            angleStart: 270,
            angleEnd:   90,
            hue:        220,
            thickness:  15,
            blur:       20
        }
    }, options);
 // option is now created and exists here

You could do something like this

var tempOption = {
    parent: this,
    width:  280,
    height: 280
};


tempOption.circle = {
    x:          (tempOption.width / 2) + 5,   // option doesn't exist
    y:          (tempOption.height / 2) + 22, // option doesn't exist
    speed:      5,
    rotation:   0,
    angleStart: 270,
    angleEnd:   90,
    hue:        220,
    thickness:  15,
    blur:       20
};


var option = jQuery.extend(tempOption, options);

相关问答

更多
  • 阅读第一行,然后将其他所有内容解析为json.loads() : with open("training_json.json") as data_file: number = next(data_file).strip() your_json = json.loads(data_file.read()) 如果每行都有不同的JSON对象(如从图像中看到的那样),则逐行读取其余的内容并存储在列表中: with open("training_json.json") as data_file: ...
  • 尝试这个: QVariantList testList = address["test"].toList(); QVariantMap map = testList[0].toMap(); qDebug() << "Nom is " << map["nom"].toString(); qDebug() << "Prenom is " << map["prenom"].toString(); Try this: QVariantList testList = address["test"].toList( ...
  • 你走在正确的轨道上。 :只是属性的无效字符,必须处理特殊。 echo $json->{'ISBN:9781430215752'}->info_url; 会得到你预期的结果。 You are on the right track. : is just an invalid character for a property and must be handled special. echo $json->{'ISBN:9781430215752'}->info_url; will get you the e ...
  • 传递Form2 Form1的实例,就像在form2的类构造函数中一样。 不要实例化一个新的(不可见的)Form1,就像你在这里做的那样: (new Form1()).LabelText 解决方案: private Form form1; public Form2(Form theForm1) { form1 = theForm1; } ... ((Form1)form1).LabelText = "It works"; 调用代码: Form2 frm2 = new Form2(this); “th ...
  • 如果您可以更改文本文件存储数据的方式,我建议将所有内容放入JSON数组中; 这样,每个文件只有一个JSON对象,这意味着您可以使用JSON解析器纯粹解析它。 If you can change the way the text file stores the data, I recommend putting all the stuff into a JSON array; that way, each file will have only a single JSON object, meaning yo ...
  • 这个: for(var i=0;i
  • 你无法使用这样的对象,你必须做这样的事情; var width = height = 280; // store values var option = jQuery.extend({ parent: this, width: width, height: height circle: { x: (width / 2) + 5, // option doesn't exist ...
  • OnNavigatedTo将在均匀加载Pivot控件之前调用,因此设置SelectedIndex不会影响其选择。 简单的解决方法是订阅Loaded事件,然后从那里设置它。 只需在MainPage的构造函数中执行以下操作 - FilterPivot.Loaded += (s, e) => FilterPivot.SelectedIndex = 0; The OnNavigatedTo will be invoked before the Pivot control is even loaded, so se ...
  • 一种方法是使用mvexpand运算符(参见文档 )。 它将为数组中的每个元素输出一行,您可以迭代它。 所以在你的例子中,运行: traces | extend d = parsejson(message) | mvexpand d.address 将为每个地址输出一行。 One way to do this would be using the mvexpand operator (see documentation). It will output a single row for each eleme ...
  • 这甚至没有格式错误的JSON,它是一个Python字典文字。 解码它的一个好方法是使用ast.literal_eval (因为这将确保它不能包含任何危险): import ast txt = r"{u'results': [{u'status': u'OK', u'time': 199, u'name': u'Macap\xe1'}]}" obj = ast.literal_eval(txt) That's not even malformed JSON, it's a Python dictionar ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。