VB6.0用掲示板の過去のログ(No.2)−VBレスキュー(花ちゃん)
[記事リスト] [新規投稿] [新着記事] [ワード検索] [管理用]

投稿日: 2004/11/02(Tue) 08:35
投稿者riderX
Eメール
URL
タイトルRe: VB6.0で住所の分割を行いたい

すみません!
確かに説明不足でした。m(_ _)m
文章書くの苦手なんですよね;^o^)A

AccessのVBAでの処理です。

Option Compare Database
Private Declare Function SeparateAddress Lib "C:\Program Files\Microsoft Office\Office\MSYubin7.dll" (ByVal szAddress As String, ByVal szZip5 As String, ByVal szZip7 As String, ByVal szKen As String, ByVal szCty1 As String, ByVal szCty2 As String, ByVal szTwn As String, ByVal szTwnExt As String) As Long

Public Sub prcAddSet(strFullAdd As String, strAdd() As String)

    Dim stZip5 As String, stZip7 As String
    Dim stKen As String, stCty1 As String, stCty2 As String, stTwn As String
    Dim stExt As String
    
    stZip5 = String(10, 0)
    stZip7 = String(10, 0)
    stKen = String(256, 0)
    stCty1 = String(256, 0)
    stCty2 = String(256, 0)
    stTwn = String(256, 0)
    stExt = String(1024, 0)
    
    If SeparateAddress(strFullAdd, stZip5, stZip7, stKen, stCty1, stCty2, stTwn, stExt) = 0 Then
        strAdd(1) = ""
        strAdd(2) = strFullAdd
        strAdd(3) = ""
        strAdd(4) = ""
        strAdd(5) = ""
        strAdd(6) = ""
    Else
        strAdd(1) = Trim(Left$(stZip7, InStr(1, stZip7, Chr$(0), vbBinaryCompare) - 1))
        strAdd(2) = Trim(Left$(stKen, InStr(1, stKen, Chr$(0), vbBinaryCompare) - 1))
        strAdd(3) = Trim(Left$(stCty1, InStr(1, stCty1, Chr$(0), vbBinaryCompare) - 1))
        strAdd(4) = Trim(Left$(stCty2, InStr(1, stCty2, Chr$(0), vbBinaryCompare) - 1))
        strAdd(5) = Trim(Left$(stTwn, InStr(1, stTwn, Chr$(0), vbBinaryCompare) - 1))
        strAdd(6) = Left$(stExt, InStr(1, stExt, Chr$(0), vbBinaryCompare) - 1)
    End If

End Sub

これをVBに移行すると分割されません。

何か良い方法は無いですか?
よろしくお願いします。

これでも、やっぱりわかりにくいですよね?
どう書いたらいいのかなぁ?

分割するのは・・・
郵便番号
都道府県
市区町村
町域名

と、言うふうに分けたいのですが・・・・


- 関連一覧ツリー (★ をクリックするとツリー全体を一括表示します)

- 返信フォーム (この記事に返信する場合は下記フォームから投稿して下さい)

- VBレスキュー(花ちゃん) - - Web Forum -