Access : ش鹷·شѺ¹ кҹ
Access : ش鹷·شѺ¹ ¹
Access : 駵纰ҹ еǨѴðҹ
Thai Access : ¹ Access

֡㹾ҡسҸԤسѹҷش кҷ稾лԹԾʹപ мʴä

Back to Board : Thai Access Webboard New Topic    Reply
print report ҧҡѹ ҧä

Topic by Message Posted : on : 20/6/2555 11:56:44
 úǹҹҨзҹ˹¤ ʹ١ 2 Ѻ ѧ վͷ ֧ͧ 觻 Ẻͧ١ ͧ dlookup ѧö úǹҹ

function ˹پ¹ ҳ ѧ վͷ

Function PrintInvoice(OrderID As Long) As Boolean
Dim Result
Result = DLookup("[Language]", "Customers", "Language")
     If Result = "TH" Then
    DoCmd.OpenReport "InvoiceTH", acViewPreview, , "[Order ID]=" & OrderID, acDialog
    Else
    DoCmd.OpenReport "InvoiceEN", acViewPreview, , "[Order ID]=" & OrderID, acDialog
    End If
End Function

úǹ˹¹Ф

68 Reply in this Topic. Dispaly 7 pages and you are on page number 4

Reply by Message on : 11/7/2555 16:06:43

(R13301)
ҹҨе˹ٷǤ ͺФسҡ¹Ф ͹ͻѭشǤ ҷӵç ж١ҹԧǫ˹٨дҡ¤

ѭ 繢Ť͹Ф ԹҢͧ˹Թһ ӵūͧ,ͫͧ,ѹͧ Ҥҷ١з͹ѹҤҨТѺẺͧ١Ҵ աþLOGOͧ١ŧ价ͧ Щй ˹ ADD product зӵٻá ṻ仹Ф ͡ Company ǡ͡Product ˹ҧҧProduct Standard ˹¡ҧ ProductCode 觨ͺѷҧ˹ úǹҨٷٻФ

Ӷ1 Ը˹з˹͡CompamyǪCompanyж١copy Ң鹷ProductCode ͡Product Product ж١Copy ͨҡ Company


Back to Top
Reply by Message on : 11/7/2555 16:16:15

(R13302)
Ӷͷ2 ԴInvoice Ф ͧҡadd product ͧкѷ繵зProduct ҡ ԴInvoice ͧproduc ˹ҡ¹سѹآ շҧж˹٤ԡ͡Company ԹҢͧCompany鹡Т(੾ТͧcompanyФ) ٻͤԡҹ ҡԹҢͧҹеçProductCode Ҩadd Companyҧ˹

úǹسѹآաչФ :)

Back to Top
Reply by Message on : 11/7/2555 17:35:53
ѹآ
(R13306)
1. ѭѹҪͷդ "ѷ" "ӡѴ" 价ء١ Ҩ仹ФѺ 仡˹ Ը 2 Ẻ ٻẺö͹ҵç˹繪ҹ ( "ѷ" "ӡѴ") "ҷԾ ӡѴ, ѷ" "ѷ [ҷԾ] ӡѴ" Ըáբ¤㴷ͧʴͺѷ١ͧ "ѷ ҷԾ ӡѴ" еͧ¹ͨѴá͹ʴ;ա   ǹաԸդ ҧաŴ֧੾Ъ "ҷԾ"    ѧҡ͡ ֧зӡõͤѺ Product Code AfterUpdate event procedure ͧ駤 Company ProductName ѡɳ

Private Sub xxxxxx_AfterUpdate
     Me.ͤŢͧProductCode = Trim(nz(ͷѴҡŴ Company (Ըá) ͪͤŢͧաŴ纪ҧҡ (Ըշͧ), "") & " " & Nz(Me.ͤŢͧProductName, ""))
End Sub

2. ͹ѺӶ ͡ѧѴʴͧ͢ѧѴ AfterUpdate event procedure ͧ⺺͡Customer

Private Sub xxxxxx_AfterUpdate
     Me.subform.form.ͤ⺺ͧ͡Product.RowSource = "select Ŵҧͧʴ from Թ where ͿŴProductCode like * '" & ͷѴҡŴ Company (Ըá) ͪͤŢͧաŴ纪ҧҡ (Ըշͧ) & "'"
End Sub

OnCurrent event procedure ͧ⺺͡Customer

Private Sub xxxxxx_Current
     If Not Me.NewRecord Then
        (͹ҧ)
     End If
End Sub
Back to Top
Reply by Message on : 11/7/2555 17:38:11
ѹآ
(R13307)


like '*" & ͷѴҡŴ Company (Ըá) ͪͤŢͧաŴ纪ҧҡ (Ըշͧ) & "*'"
Back to Top
Reply by Message on : 12/7/2555 14:25:22

(R13324)
ѺҺзҹҨ ѹ˹ҧ͡ Ѻ仨պ仴ԹШպ§ҹŹФ ͺФسҡ :) :) :)
Back to Top
Reply by Message on : 30/7/2555 13:28:58

(R13444)
ҹҨ ˹觡Ѻµ ѧ˹Ф :)   
Back to Top
Reply by Message on : 1/8/2555 11:32:48

(R13457)
ҹҨ ˹§ҹ

ͷ 1 ͧadd product ˹ٷǹФ ^^
ǹͷ 2 ѧ ѧѴͧcodeҷ

ͧ 3 ͵çͧcomboҪ١,ʶҳ ˹¶سѹآ ˹ҡçҡФе͹ѹФ੾еѡá(ٻФ)¶֧ҵͧӤẺç͵á˹٨ФҤ繤ӵçҧͤ㹪ͧ2 ʶҳ ͧ3 ID ͧ˹ ˹ҡءͧءФ :( ͧ䢵ç˹Ҥ





ѧ Ф
Back to Top
Reply by Message on : 1/8/2555 11:36:02

(R13458)
ɤҨ ٻ ٻٻͤ

Back to Top
Reply by Message on : 1/8/2555 11:48:13

(R13459)
SELECT [ID], [Company], [Address For Ship], [ID] FROM [Customers Extended] WHERE [ID]<>Nz(Form!ID,0) ORDER BY [Company], [Address For Ship];

͹ code
Back to Top
Reply by Message on : 1/8/2555 12:40:45

(R13460)
Ҩ ͧ 2 ˹codeҨú͡ѹerror Ẻ


˹code١شҤ
ǹ code


Option Compare Database
Option Explicit


Sub SetDefaultShippingAddress()
    If IsNull(Me![Customer ID]) Then
        ClearShippingAddress
    Else
       
        Dim rsw As New RecordsetWrapper
        If rsw.OpenRecordset("Customers Extended", "[ID] = " & Me.Customer_ID) Then
        Me.[InvoiceNO] = DMax("[InvoiceNumber]", "[Orders]") + 1
            With rsw.Recordset
               Me![Ship Name] = ![Contact Name]
               Me![Ship Address] = ![Address]
               End With
        End If
    End If
End Sub


Private Sub cmdDeleteOrder_Click()
    If IsNull(Me![Order ID]) Then
        Beep
    ElseIf Me![Status ID] = Shipped_CustomerOrder Or Me![Status ID] = Closed_CustomerOrder Then
        MsgBoxOKOnly CannotCancelShippedOrder
    ElseIf MsgBoxYesNo(CancelOrderConfirmPrompt) Then
        If CustomerOrders.Delete(Me![Order ID]) Then
            MsgBoxOKOnly CancelOrderSuccess
            eh.TryToCloseObject
        Else
            MsgBoxOKOnly CancelOrderFailure
        End If
    End If
End Sub


Private Sub cmdClearAddress_Click()
    ClearShippingAddress
End Sub


Private Sub ClearShippingAddress()
    Me![Ship Name] = Null
    Me![Ship Address] = Null
    Me![Ship City] = Null
    Me![Ship State/Province] = Null
    Me![Ship ZIP/Postal Code] = Null
    Me![Ship Country/Region] = Null
End Sub


Private Sub cmdCompleteOrder_Click()
    If Me![Status ID] <> Shipped_CustomerOrder Then
        MsgBoxOKOnly OrderMustBeShippedToClose
    ElseIf ValidateOrder(Closed_CustomerOrder) Then
        Me![Status ID] = Closed_CustomerOrder
        eh.TryToSaveRecord
        MsgBoxOKOnly OrderMarkedClosed
        SetFormState
    
    End If
End Sub


Private Sub cmdCreateInvoice_Click()
    Dim OrderID As Long
    Dim InvoiceID As Long

    OrderID = Nz(Me![Order ID], 0)
    
    ' Gracefully exit if invoice already created
    If CustomerOrders.IsInvoiced(OrderID) Then
        If MsgBoxYesNo(OrderAlreadyInvoiced) Then
       
        CustomerOrders.PrintInvoice Me.Customer_ID, OrderID
       
        End If
    ElseIf ValidateOrder(Invoiced_CustomerOrder) Then
       
        ' Create Invoice Record
        If CustomerOrders.CreateInvoice(OrderID, 0, InvoiceID) Then
            
            ' Mark all Order Items Invoiced
            ' Need to change Inventory Status to SOLD from HOLD
            Dim rsw As New RecordsetWrapper
            With rsw.GetRecordsetClone(Me.sbfOrderDetails.Form.Recordset)
               While Not .EOF
                    If Not IsNull(![Inventory ID]) And ![Status ID] = OnHold_OrderItemStatus Then
                        rsw.Edit
                        ![Status ID] = Invoiced_OrderItemStatus
                        rsw.Update
                        Inventory.HoldToSold ![Inventory ID]
                    End If
                    rsw.MoveNext
               Wend
            End With
            
            ' Print the Invoice
          CustomerOrders.PrintInvoice Me.Customer_ID, OrderID

       
            SetFormState
        End If
    End If
End Sub



Private Sub cmdShipOrder_Click()
    If Not CustomerOrders.IsInvoiced(Nz(Me![Order ID], 0)) Then
        MsgBoxOKOnly CannotShipNotInvoiced
    ElseIf Not ValidateShipping() Then
        MsgBoxOKOnly ShippingNotComplete
    Else
        Me![Status ID] = Shipped_CustomerOrder
    
        If IsNull(Me![Shipped Date]) Then
            Me![Shipped Date] = Date
        End If
        eh.TryToSaveRecord
        SetFormState
    End If
End Sub


Private Sub Customer_ID_AfterUpdate()
      Me.[Customer Orders Subform].Form.[Product ID].RowSource = "SELECT [ID], [Company], [Address For Ship], [ID] FROM [Customers Extended] WHERE [Product Code] like '*" & [Customer ID] & "*'"
    SetFormState False
    If Not IsNull(Me![Customer ID]) Then
        SetDefaultShippingAddress
    End If
End Sub
Private Sub Form_Current()
If Not Me.NewRecord Then
      Me.[Customer Orders Subform].Form.[Product ID].RowSource = "SELECT [ID], [Company], [Address For Ship], [ID] FROM [Customers Extended] WHERE [Product Code] like '*" & [Customer ID] & "*'"
    SetFormState
    End If
End Sub



Private Sub Form_Load()
    SetFormState
End Sub


Function GetDefaultSalesPersonID() As Long
    GetDefaultSalesPersonID = GetCurrentUserID()
End Function

Function ValidateShipping() As Boolean
   If Nz(Me![Shipping Fee]) = "" Then Exit Function
    ValidateShipping = True
End Function

Function ValidatePaymentInfo() As Boolean
    If IsNull(Me![Payment Type]) Then Exit Function
    If IsNull(Me![Paid Date]) Then Exit Function
    
    ValidatePaymentInfo = True
End Function


Sub SetFormState(Optional fChangeFocus As Boolean = True)
    If fChangeFocus Then Me.Customer_ID.SetFocus
    Dim Status As CustomerOrderStatusEnum
       
    Status = Nz(Me![Status ID], New_CustomerOrder)

    TabCtlOrderData.Enabled = Not IsNull(Me![Customer ID])
    Me.cmdCreateInvoice.Enabled = (Status = New_CustomerOrder)
    
    Me.cmdShipOrder.Enabled = (Status = New_CustomerOrder) Or (Status = Invoiced_CustomerOrder)
   
    Me.cmdDeleteOrder.Enabled = (Status = New_CustomerOrder) Or (Status = Invoiced_CustomerOrder)
    Me.cmdCompleteOrder.Enabled = (Status <> Closed_CustomerOrder)
    
    
    Me.[Order Details_Page].Enabled = (Status = New_CustomerOrder)
    Me.[Shipping Information_Page].Enabled = (Status = New_CustomerOrder)
    Me.[Payment Information_Page].Enabled = (Status <> Closed_CustomerOrder)
    
    Me.Customer_ID.Locked = (Status <> New_CustomerOrder)
    Me.Employee_ID.Locked = (Status <> New_CustomerOrder)
    Me.sbfOrderDetails.Locked = (Status <> New_CustomerOrder)

End Sub


Function ValidateOrder(Validation_OrderStatus As CustomerOrderStatusEnum) As Boolean
    If IsNull(Me![Customer ID]) Then
        MsgBoxOKOnly MustSpecifyCustomer
    ElseIf IsNull(Me![Employee ID]) Then
        MsgBoxOKOnly MustSpecifySalesPerson
    ElseIf Not ValidateShipping() Then
        MsgBoxOKOnly ShippingNotComplete
    Else
        If Validation_OrderStatus = Closed_CustomerOrder Then
            If Not ValidatePaymentInfo() Then
               MsgBoxOKOnly PaymentInfoNotComplete
               Exit Function
            End If
        End If

        Dim rsw As New RecordsetWrapper
        With rsw.GetRecordsetClone(Me.sbfOrderDetails.Form.Recordset)
            ' Check that we have at least one specified line items
            If .RecordCount = 0 Then
               MsgBoxOKOnly OrderDoesNotContainLineItems
            Else
               ' Check all that all line items have allocated inventory
               Dim LineItemCount As Integer
               Dim Status As OrderItemStatusEnum
               LineItemCount = 0
               While Not .EOF
                    
                    LineItemCount = LineItemCount + 1
                    Status = Nz(![Status ID], None_OrderItemStatus)
                    If Status <> OnHold_OrderItemStatus And Status <> Invoiced_OrderItemStatus Then
                        MsgBoxOKOnly MustBeAllocatedBeforeInvoicing
                        Exit Function
                    End If
                    rsw.MoveNext
               Wend
                                        
               ValidateOrder = True
            End If
        End With
    End If
End Function



Boxcustomer Customer ID
product code product code
ͧ͵çѺproduct code Company

е͹á Product code ˹Ҩ繪͵ѴҵҨú͡Ф ˹繪Company«ҵͤӵçcompany ѹIDͧ١᷹ʹªԹҤ




(ID ͧAmiri 4 úǹй˹˹¹Ф :) )
Back to Top
Page:   << Prev 1 2 35 6 7 Next >>

Reply

 *Indicates required fields
Format:
Bold Under Line Italic Add Hyperlink Add Email Link Italic List Indent Add Image Emoticons Insert code Mode:
Message:*
Your Name*:
Normal word*: Please input :
+++ webboard source: ASPThai.Net Webboard 6.0 webbord +++++++ admin : yeadram +++