แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nonc31

หน้า: 1 [2] 3 4 5
19
ห้อง MS Access / : Export file to Excel แบบหลายชีท
« เมื่อ: 21 ก.พ. 66 , 15:48:12 »
ใช้สูตรใน Excel เลยครับ  อย่าให้เดือดร้อน Access เลย   :cool: :cool: :cool:
โพสต์นี้ได้รับคำขอบคุณจาก: attapong

20
สร้างฟิลด์ลำดับเพิ่ม แล้วใช้การ Loop เข้ามาช่วย
โพสต์นี้ได้รับคำขอบคุณจาก: laemthong, aphichet.p@gmail.com, พีระณัฐ สุขกำเนิด

21
ห้อง MS Access / : Export file to Excel แบบหลายชีท
« เมื่อ: 20 ก.พ. 66 , 21:37:40 »
                            Dim expXLS, Sheet1, Sheet2, Sheet3, Sheet4, ไปเรื่อยๆ As String
                            expXLS = "D:\test.xls"
                            Sheet1 = "ตาราง/คิวรี่1"
                            Sheet2 = "ตาราง/คิวรี่2"
                            Sheet3 = "ตาราง/คิวรี่3"
                            Sheet4 = "ตาราง/คิวรี่4"
                            ไปเรื่อยๆ.............
                            DoCmd.TransferSpreadsheet acExport, เวอร์ชั่น Excel, Sheet1, expXLS, True
                            DoCmd.TransferSpreadsheet acExport, เวอร์ชั่น Excel, Sheet2, expXLS, True
                            DoCmd.TransferSpreadsheet acExport, เวอร์ชั่น Excel, Sheet3, expXLS, True
                            DoCmd.TransferSpreadsheet acExport, เวอร์ชั่น Excel, Sheet4, expXLS, True
                            DoCmd.TransferSpreadsheet acExport, เวอร์ชั่น Excel, ไปเรื่อยๆ, expXLS, True
โพสต์นี้ได้รับคำขอบคุณจาก: attapong

22
ลองทำผ่าน safe mode  และลงทะเบียน Comdlg32.dll ด้วย cmd commands ครับ

สำหรับ 32บิต
cd\
C:
cd C:\windows\sysWOW64
regsvr32.exe %systemroot%\SysWOW64\Comdlg32.dll

หรือ สำหรับ 64บิต
cd\
C:
cd C:\windows\System32
regsvr32.exe %systemroot%\System32\Comdlg32.dll
โพสต์นี้ได้รับคำขอบคุณจาก: Un

23
#If Win64 Or VBA7 Then    ก็  Win64
โพสต์นี้ได้รับคำขอบคุณจาก: Un

24

Left([ฟิลด์1],InStr([ฟิลด์1],"คำค้น")-1)
โพสต์นี้ได้รับคำขอบคุณจาก: aphichet.p@gmail.com

25
#If Win64 Or VBA7 Then
    Private Declare PtrSafe Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
#Else
    Private Declare Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
#End If

ใส่  PtrSafe   กับไม่ใส่
โพสต์นี้ได้รับคำขอบคุณจาก: Un

26
DoCmd.OpenForm "B"  (สถานะ ผุดขึ้น = Yes  โมดุล = No)
DoCmd.OpenForm "A"  (สถานะ ผุดขึ้น = No  โมดุล = No)

ถ้าทำสถานะแบบนี้  ฟอร์ม B  จะทับซ้อน A อยู่  หรืออาจเปลี่ยน โมดุล = Yes  ลองดูครับ

ไม่รู้ว่าต้องการแบบซ้อนทับ หรือ แบบเรียงแบบอีกฟอร์ม1อยู่ซ้าย  ฟอร์ม2 อยู่ขวา
โพสต์นี้ได้รับคำขอบคุณจาก: kitisak, SakDa

27
เหมือนจะง่าย  แต่กว่าจะเข้าใจ  นำมาฝากครับ  วินโดว์ 7 ขึ้นมา ใช้ SendKeys "{HOME}" และ  SendKeys "{END}" ไม่ได้แล้ว

Option Compare Database

#If Win64 Or VBA7 Then
    Private Declare PtrSafe Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Private Declare PtrSafe Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
#Else
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Private Declare Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
#End If

    Private Const VK_HOME = &H24
    Private Const VK_END = &H23
    Private Const VK_F2 = &H71
   
Private Sub Command2_Click() 'SendKeys HOME
    Me.Text0.SetFocus
    keybd_event VK_F2, 1, 0, 0
    keybd_event VK_F2, 1, KEYEVENTF_KEYUP, 0
    keybd_event VK_HOME, 1, 0, 0
    keybd_event VK_HOME, 1, KEYEVENTF_KEYUP, 0
End Sub

Private Sub Command3_Click() 'SendKeys END ใช้ F2 แทน
    Me.Text0.SetFocus
    keybd_event VK_F2, 1, 0, 0
    keybd_event VK_F2, 1, KEYEVENTF_KEYUP, 0
End Sub
โพสต์นี้ได้รับคำขอบคุณจาก: UnKnown, Un

28
ห้อง MS Access / : สร้างรายการใน Combo box
« เมื่อ: 29 ธ.ค. 65 , 14:11:41 »
โพสต์นี้ได้รับคำขอบคุณจาก: kitisak

29
ตามนี้ครับ
โพสต์นี้ได้รับคำขอบคุณจาก: MAKI

30
ถามเองตอบเองอีกแล้ว :cry: :sweat: :dizzy: :ouch:


งมไปจนได้ ดำน้ำไป  คือ Loop ให้ชื่อเมลล์ ต่อกัน โดยใช้  ,  คั่น  แล้วเอาค่าไปใส่ .To = ค่าที่ Loop
โพสต์นี้ได้รับคำขอบคุณจาก: UnKnown

31
ไปได้โค๊ดที่อาจารย์ลงไว้ใน Youtube

ผมเก็บเมลล์เพื่อนๆ ไว้ถ้าต้องการ Loop ชื่อเมลล์ลงในบรรทัด  .To = Nz(ฟิลด์เก็บเมลล์)
ต้องทำโค๊ดยังไงครับ  หรือมีโค๊ดอื่นมั๊ยครับ สำหรับการส่งเมลล์เป็นกลุ่มๆ


On Error GoTo Err:
    Dim NewMail As Object
    Dim mailConfig As Object
    Dim fields As Variant
    Dim msConfigURL As String

    'late binding
    Set NewMail = CreateObject("CDO.Message")
    Set mailConfig = CreateObject("CDO.Configuration")

    ' load all default configurations
    mailConfig.Load -1

    Set fields = mailConfig.fields

    'Set All Email Properties
    With NewMail
        .Sender = Forms!mainmail!mygmail
        .From = Nz(Forms!mainmail!mydetail)
        .To = Nz(Me.fmail)  '<<<<<<<<< ต้องการ Loop  ลงตรงนี้  <<<<<<<<<<<<<<<<<<<<
        .CC = Nz(Forms!mainmail!sumnao1)
        .BCC = Nz(Forms!mainmail!sumnao2)
        .Subject = Nz(Forms!mainmail!ruang1)
        .BodyPart.Charset = "utf-8"
        .HTMLbody = "<Font Face=AngsanaUPC Size=" & Forms!mainmail!fontSiz & " Color=" & Forms!mainmail!seefon & ">" & Forms!mainmail!bui1 & Nz(Forms!mainmail!detail2) & Forms!mainmail!bui2 & "</Font>"
       
        If Not IsNull(Forms!mainmail!fi1) Then
            If Dir(Forms!mainmail!fi1) <> "" Then
                .Addattachment Nz(Forms!mainmail!fi1)
            End If
        End If
       
        If Not IsNull(Forms!mainmail!fi2) Then
            If Dir(Forms!mainmail!fi2) <> "" Then
                .Addattachment Nz(Forms!mainmail!fi2)
            End If
        End If
       
        If Not IsNull(Forms!mainmail!fi3) Then
            If Dir(Forms!mainmail!fi3) <> "" Then
                .Addattachment Nz(Forms!mainmail!fi3)
            End If
        End If
       
    End With

    msConfigURL = "http://schemas.microsoft.com/cdo/configuration"

    With fields
        .Item(msConfigURL & "/smtpusessl") = True
        .Item(msConfigURL & "/smtpauthenticate") = 1
        .Item(msConfigURL & "/smtpserver") = "smtp.gmail.com"
        .Item(msConfigURL & "/smtpserverport") = 465
        .Item(msConfigURL & "/sendusing") = 2
        .Item(msConfigURL & "/sendusername") = Forms!mainmail!mygmail
        .Item(msConfigURL & "/sendpassword") = DLookup("mypass", "mypass")
        .Update
    End With
    NewMail.Configuration = mailConfig
    NewMail.Send

Exit_Err:
    'Release object memory
    Set NewMail = Nothing
    Set mailConfig = Nothing
    End

Err:
    Select Case Err.Number
    Case -2147220973  'Could be because of Internet Connection
        MsgBox "Check your internet connection." & vbNewLine & Err.Number & ": " & Err.Description
    Case -2147220975  'Incorrect credentials User ID or password
        MsgBox "Check your login credentials and try again." & vbNewLine & Err.Number & ": " & Err.Description
    Case Else   'Report other errors
        MsgBox "Error encountered while sending email." & vbNewLine & Err.Number & ": " & Err.Description
    End Select

    Resume Exit_Err
โพสต์นี้ได้รับคำขอบคุณจาก: ่jackychaan, Surapong J Noom

32
โพสต์นี้ได้รับคำขอบคุณจาก: naekkhung

33
จากข้อมูลที่ให้มา ถ้าเอาไปเรียง ลำดับจากน้อยไปหามาก  มันจะเรียงได้ยังไงครับ  ข้อมูลเดียวกัน เหมือนกันทุกแถว  มันต้องสร้างฟิลด์เพื่อระบุการทำงานก่อนหลังด้วยครับ เป็นไปได้ช่องวันที่ ควรเก็บวันที่ ที่มีเวลาเข้าไปด้วย  Now()  หรืออาจจะสร้างฟิลด์ ID  ขึ้นมา
โพสต์นี้ได้รับคำขอบคุณจาก: arampong

34
ผมก็ได้มานานแล้ว แต่ไม่ได้ทำใช้
โพสต์นี้ได้รับคำขอบคุณจาก: aek

35
#If Win64 Or VBA7 Then
   Private Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
#Else
   Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
#End if

ทำโค๊ดแบบนี้  เอาไว้ไปรันกับเวอร์ชั่นเก่า และใหม่ได้เลย
โพสต์นี้ได้รับคำขอบคุณจาก: PNR

36
ก่อนอื่นต้องขอขอบคุณอาจารณ์ทุกท่านนะครับ ที่ได้แก้ไขปัญหาต่างๆ ในการทำ Code  ....
สำหรับโพสนี้ ก็หวังว่าท่านที่ต้องการทำแบบผม กำลังมองหาวิธีการต่างๆนานา (เหมือนผม)
จะได้รับประโยชน์ครับ
โพสต์นี้ได้รับคำขอบคุณจาก: SakDa, PNR, vmfc

หน้า: 1 [2] 3 4 5