簡體   English   中英

Microsoft Access-搜索查詢

[英]Microsoft Access - Search Query

我有兩個字符串:

1. #ck#
2. #c44#

這些位於像這樣的字符串中

“#CK#站點B:Delta機櫃和STM-1 auf ODF的附加標志中的Umbau der IDU vom”

我無法在Excel中使用類似於isnumber(search)的函數。 我想在字符串中找到#ck#或#c44#,然后使用iif進一步將其命名為更有意義的名稱。

我使用兩種方法來查找您的字符串。 首先,如果將您的字符串放在Cell(1,2)的Cell(1,1)中(我也將#c44#添加到該字符串),則輸入公式:

=FIND("#c44#",A1,1)

請注意,CASE必須匹配,否則將找不到字符串!

第二種方法如下

Option Explicit

Function Find_Pound()
Dim strString   As String
Dim strFind1    As String
Dim i           As Integer

'"#CK# Site B: Umbau der IDU vom in Delta-Cabinets und Auflage der #c44# STM-1 auf ODF"
    strString = Sheet1.Cells(1, 1)      
    strFind1 = "#CK#"
    i = InStr(1, strString, strFind1)
    If i > 0 Then
        MsgBox "Found: '" & strFind1 & "' at position: " & i
    End If

    strFind1 = "#c44#"
    i = InStr(1, strString, strFind1)
    If i > 0 Then
        MsgBox "Found: '" & strFind1 & "' at position: " & i
    End If

End Function

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM