0% found this document useful (0 votes)
4 views

Code VB

Uploaded by

qasimcarnby
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Code VB

Uploaded by

qasimcarnby
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sub OpenOrder(Optional PurchaseOrderID As Long)

If (PurchaseOrderID > 0) Then


DoCmd.OpenForm "Purchase Order Details", acNormal, , "[Purchase Order ID]="
& PurchaseOrderID, acFormEdit, acDialog
Else
DoCmd.OpenForm "Purchase Order Details", acNormal, , , acFormAdd, acDialog
End If
End Sub

PurchaseContainsLineItems = Me.GetPurchaseDetailsSubform.RecordsetClone.RecordCount
> 0

Private Sub ClassName_KeyDown(KeyCode As Integer, Shift As Integer)

'Dim intShiftDown As Integer, intAltDown As Integer


'Dim intCtrlDown As Integer

' Use bit masks to determine which key was pressed.


'intShiftDown = (Shift And acShiftMask) > 0
'intAltDown = (Shift And acAltMask) > 0
'intCtrlDown = (Shift And acCtrlMask) > 0
' Display message telling user which key was pressed.
'If intShiftDown Then MsgBox "You pressed the SHIFT key."
'If intAltDown Then MsgBox "You pressed the ALT key."
'If intCtrlDown Then MsgBox "You pressed the CTRL key."
Dim intShiftDown As Integer, intAltDown As Integer
intShiftDown = (Shift And acShiftMask) > 0
If intShiftDown Then
MsgBox "You pressed the SHIFT key."
DoCmd.Close acForm, "cc"
End If

End Sub

curX = DSum("[Freight]", "Orders", "[ShipCountry] = 'UK'")


Dim curX As Currency
curX = DSum("[Freight]", "Orders", _
"[ShipCountry] = 'UK' AND [ShippedDate] > #1-1-95#")

curX : DSum("[qty]";"ordersub";"[productid] = [productid] and


[ordersubnumber]=[ordersubnumber]")

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)


If KeyCode = vbKeyReturn Then
If Not Shift = acCtrlMask Then
MsgBox "Enter"
KeyCode = 0
Me.parent.Combo.SetFocus
End If
End If
End Sub

DSum("[Value]","[Query]","[ID]=" & [ID] & " And [Date]<=#" & Format([Date],


"yyyy\/mm\/dd") & "#")

Function IsLoaded(ByVal strFormName As String) As Boolean


' Returns True if the specified form is open in Form view or Datasheet view.
Dim oAccessObject As AccessObject

Set oAccessObject = CurrentProject.AllForms(strFormName)


If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If

End Function

Function IsLoaded(ByVal strFormName As String) As Boolean


' Returns True if the specified form is open in Form view or Datasheet view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed


Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If

End Function

Private Sub Command284_Click()

DoCmd.RunCommand acCmdRefresh

Dim strFormName As String

If CurrentProject.AllForms("Purchase Orders").IsLoaded Then


strFormName = "Purchase Orders"
ElseIf CurrentProject.AllForms("Purchase Orders New").IsLoaded Then
strFormName = "Purchase Orders New"
End If

Function DeleteARecord
If MsgBox("Do you wish to delete this record?", vbYesNo, "Delete Confirmation") =
vbYes Then
If MsgBox("Are you SURE you want to delete this record?" & vbCrLf & _
"This will permanently delete the record.", vbYesNo, "2nd Delete Confirmation")
= vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
End If
End If
End Function

Private Sub DeleteButton_Click()


DeleteARecord
End Sub

If MsgBox("Do you wish to delete this record?", vbYesNo, "Delete Confirmation") =


vbYes Then
If MsgBox("Are you SURE you want to delete this record?" & vbCrLf & _
"This will permanently delete the record.", vbYesNo, "2nd Delete Confirmation")
= vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
End If
End If

You might also like