---
title: "字符串截示例"
author: "liseor"
date: "2011-01-28T13:36:23Z"
tags: ["Access", "C", "C++", "QQ", "Web"]
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2011-01-28T14:27:55Z"
id: 898853
url: "https://liseor.iteye.com/blog/898853"
---

<span style="color:red">ACCESS 打开网页</span>

```c#

Private Sub cmdAccess_Click()
    Dim webAddreess As String
    Dim Web
    Set Web = CreateObject("InternetExplorer.Application")
    Web.Visible = True
    WebAddress = "http://www.accessoft.com"
    Web.Navigate WebAddress

End Sub

```


<span style="color:red">ACCESS　执行子窗体SQL</span>

```C#

Private Sub cmdClear_Click()
    Me.frmChild.SourceObject = ""
    '去掉系统警告
    DoCmd.SetWarnings False
    '清空截取的字符值
    DoCmd.RunSQL "UPDATE tblSizelist SET tblSizelist.size1 = Null, tblSizelist.size2 = Null, tblSizelist.size3 = Null;"
    '重新加载子窗体
    Me.frmChild.SourceObject = "frmSizelist"
End Sub


```



<span style="color:red">ACCESS　关闭子窗体</span>

```C#

Private Sub cmdClose_Click()
    DoCmd.Close
End Sub

```



<span style="color:red">ACCESS　打开QQ 对话窗口</span>

```C#

Private Sub cmdQQ_Click()
    Dim webAddreess As String
    Dim Web
    Set Web = CreateObject("InternetExplorer.Application")
    Web.Visible = True
    WebAddress = "http://wpa.qq.com/msgrd?V=1&Uin=56217686&Site=UMVsoft&Menu=yes"
    '打开QQ 对话窗口
    Web.Navigate WebAddress

End Sub

Private Sub Form_Load()
'给窗体写上标题
    Me.Caption = "实现字符串提取功能的示例"

End Sub

```



<span style="color:red">ACCESS　截取字符</span>

```C#


Private Sub cmdOK_Click()
    Dim RST As DAO.Recordset
    Dim strSize As String
    Dim strSizeB As String
    Dim x As Integer
    Dim y As Integer
    Me.frmChild.SourceObject = ""
    Set RST = CurrentDb.OpenRecordset("tblSizelist", dbOpenDynaset)
    RST.MoveFirst
    Do Until RST.EOF
        RST.Edit
        strSize = RST!OrderSize
        '获得第一个*号出现的位置
        x = InStr(strSize, "*")
        strSizeB = Mid(strSize, x + 1)
        '获得第二个*出现的位置
        y = InStr(strSizeB, "*") + x
        RST!size1 = Left(strSize, x - 1)
        RST!size2 = Mid(strSize, x + 1, y - x - 1)
        RST!size3 = Mid(strSize, y + 1)
        RST.Update
        RST.MoveNext
    Loop
    RST.Close
    Set RST = Nothing

    '重新加载子窗体
    Me.frmChild.SourceObject = "frmSizelist"

End Sub

```