แสดงกระทู้

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 6 ... 9
37
ลองทำผ่าน 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

38
#If Win64 Or VBA7 Then    ก็  Win64

39

Left([ฟิลด์1],InStr([ฟิลด์1],"คำค้น")-1)

40
ลองทำการ Compile  ดูก่อนครับ   ถ้าติด Error ต้องแก้ไขให้เรียบร้อยครับ

41
#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   กับไม่ใส่

42
ห้อง MS Access / : คำสั่ง export file เป็น excel
« เมื่อ: 20 ม.ค. 66 , 08:55:17 »
ผมใช้ Access 2013  ทำโปรแกรมนามสกุล .accdb
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qrysel1", "D:\test.xlsx", True
ส่งออกสำเร็จ

แต่ถ้าเป็นโปรแกรมนามสกุล .mdb  ถึงแม้จะเปิดผ่าน Access 2013  ก็ไม่สามารถทำได้
ที่จริงส่งเป็น .xls  ก็ OK  นะครับ  เพราะมันเปิด excel ได้หลายเวอร์ชั่น

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

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

ไม่รู้ว่าต้องการแบบซ้อนทับ หรือ แบบเรียงแบบอีกฟอร์ม1อยู่ซ้าย  ฟอร์ม2 อยู่ขวา

45
ลองใช้ TimerInterval  ทดสอบ 5วิ  ไม่รู้จะตรงมั๊ย  ลองดัดแปลงเอานะครับ

46
ทำตามบทเรียน ที่อาจารย์ แสดงไว้ใน Youtube 

แต่ผมทำไม่ผ่าน  ขอความช่วยเหลือครับ

47
ควรให้ใส่ค่าตอนมีการ "บันทึก" ข้อมูล  ไม่ควรใส่เพราะว่า "ค้นเจอ" ครับ

ตอบข้อ1. me.out = now  แล้วช่อง  txtin  มีไว้เพื่อ....  ในเมื่อมันเป็นแค่สูตร  ไม่ได้เก็บลงฐาน
ตอบข้อ2. me.ช่องที่กำหนด=me.ช่องหนึ่ง

49
เหมือนจะง่าย  แต่กว่าจะเข้าใจ  นำมาฝากครับ  วินโดว์ 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

50
ห้อง MS Access / : สร้างรายการใน Combo box
« เมื่อ: 29 ธ.ค. 65 , 14:11:41 »

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


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

53
ขอบคุณครับ  :love: :love: :love:

54
ไปได้โค๊ดที่อาจารย์ลงไว้ใน 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

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