Warning: I am very new to Access coding. I am used to .NET and PHP
I just converted an Access 95 program to Access 2007 and I got it all working now I am trying to make some updates.
I have a form that updates a table in the database but I can't find an attached query or anywhere where it actually does a SQL statement. Please help. And thank you.
This is all the code on the one form.
Option Compare Database
`enter code here`Option Explicit
Private Sub Check158_Click()
' Try and change sql code
Me.Combo35.RowSource = "SelectAllOrders"
End Sub
Private Sub Combo35_AfterUpdate()
Me.RecordsetClone.FindFirst "[OrderID] = " & Me![Combo35]
Me.Bookmark = Me.RecordsetClone.Bookmark
' Find the record that matches the control.
End Sub
Private Sub Command122_Click()
On Error GoTo Err_Command122_Click
DoCmd.Close
Exit_Command122_Click:
Exit Sub
Err_Command122_Click:
MsgBox Err.Description
Resume Exit_Command122_Click
End Sub
Private Sub Customer_AfterUpdate()
Forms![Orders]![CustomerID] = [Forms]![Orders]![Customer].Column(0)
Forms![Orders]![Phone] = [Forms]![Orders]![Customer].Column(2)
End Sub
Private Sub Frame40_AfterUpdate()
'Forms![Orders]![Orders Subform].Form![Quantity]
If Forms![Orders]![Frame40] = 1 Then
' Me![Orders By Customer Subform].[Requery
Forms![Orders]![Child81].Form![ProductID].RowSource = "StdPrice"
Else
Forms![Orders]![Child81].Form![ProductID].RowSource = "PvtPrice"
End If
End Sub
Private Sub Command131_Click()
On Error GoTo Err_Command131_Click
Me![Invoice Total] = Forms![Orders]![Child81].Form![Order Subtotal]
DoCmd.GoToRecord , , acNewRec
Exit_Command131_Click:
Exit Sub
Err_Command131_Click:
MsgBox Err.Description
Resume Exit_Command131_Click
End Sub
Private Sub Command132_Click()
On Error GoTo Err_Command132_Click
'Cancel Click for Orders
If Me.Dirty Then DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Me![Invoice Total] = Forms![Orders]![Child81].Form![Order Subtotal]
DoCmd.Close
Exit_Command132_Click:
Exit Sub
Err_Command132_Click:
MsgBox Err.Description
Resume Exit_Command132_Click
End Sub
Private Sub Command133_Click()
On Error GoTo Err_Command133_Click
'Save and Exit Click
Me![Invoice Total] = Forms![Orders]![Child81].Form![Order Subtotal]
DoCmd.Close
Exit_Command133_Click:
Exit Sub
Err_Command133_Click:
MsgBox Err.Description
Resume Exit_Command133_Click
End Sub
Private Sub Command134_Click()
On Error GoTo Err_Command134_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Exit_Command134_Click:
Exit Sub
Err_Command134_Click:
MsgBox Err.Description
Resume Exit_Command134_Click
End Sub
Private Sub Command136_Click()
On Error GoTo Err_Command136_Click
DoCmd.GoToRecord , , acNext
Exit_Command136_Click:
Exit Sub
Err_Command136_Click:
MsgBox Err.Description
Resume Exit_Command136_Click
End Sub
Private Sub Command138_Click()
On Error GoTo Err_Command138_Click
Me![Invoice Total] = Forms![Orders]![Child81].Form![Order Subtotal]
DoCmd.GoToRecord , , acNext
Exit_Command138_Click:
Exit Sub
Err_Command138_Click:
MsgBox Err.Description
Resume Exit_Command138_Click
End Sub
Private Sub Command148_Click()
On Error GoTo Err_Command148_Click
Dim stDocName As String
stDocName = "Container Card"
DoCmd.OpenReport stDocName, acPreview, , "[OrderID] = Forms![Orders]![OrderID]"
Exit_Command148_Click:
Exit Sub
Err_Command148_Click:
MsgBox Err.Description
Resume Exit_Command148_Click
End Sub
Private Sub Form_Close()
' Me![Invoice Total] = Forms![Orders]![Child81].Form![Order Subtotal]
End Sub
And a SUB form
Option Compare Database
Option Explicit
Private Sub Form_AfterDelConfirm(Status As Integer)
Forms![Orders]![Child81].Requery
End Sub
Private Sub Form_Open(Cancel As Integer)
'If Forms![Orders]![Frame40] = 1 Then
' Me![ProductID].RowSource = "StdPrice"
' Else
' Me![ProductID].RowSource = "PvtPrice"'
'End If
End Sub
Private Sub ProductID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub ProductID_AfterUpdate()
Dim pos As Variant
Me![UnitPrice] = Me![ProductID].Column(2)
Me![ProductName] = Me![ProductID].Column(1)
Me![GLAcct] = Me![ProductID].Column(3)
Me.Dirty = False
End Sub
Private Sub ProductID_DblClick(Cancel As Integer)
On Error GoTo Err_ProductID_DblClick
Dim lngProductID As Long
If IsNull(Me![ProductID]) Then
Me![ProductID].Text = ""
Else
lngProductID = Me![ProductID]
Me![ProductID] = Null
End If
DoCmd.OpenForm "Products", , , , , acDialog, "GotoNew"
Me!ProductID.Requery
If lngProductID <> 0 Then Me![ProductID] = lngProductID
Exit_ProductID_DblClick:
Exit Sub
Err_ProductID_DblClick:
MsgBox Err.Description
Resume Exit_ProductID_DblClick
End Sub
Private Sub Command20_Click()
On Error GoTo Err_Command20_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command20_Click:
Exit Sub
Err_Command20_Click:
MsgBox Err.Description
Resume Exit_Command20_Click
End Sub
Private Sub Command22_Click()
On Error GoTo Err_Command22_Click
DoCmd.GoToRecord , , acNext
Exit_Command22_Click:
Exit Sub
Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click
End Sub
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
DoCmd.GoToRecord , , acFirst
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub
Private Sub Command24_Click()
On Error GoTo Err_Command24_Click
DoCmd.GoToRecord , , acPrevious
Exit_Command24_Click:
Exit Sub
Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click
End Sub
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click
DoCmd.GoToRecord , , acLast
Exit_Command25_Click:
Exit Sub
Err_Command25_Click:
MsgBox Err.Description
Resume Exit_Command25_Click
End Sub
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click
DoCmd.GoToRecord , , acNext
Exit_Command26_Click:
Exit Sub
Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click
End Sub
Private Sub Quantity_AfterUpdate()
Dim pos As Variant
'Me.Dirty = False
End Sub
Private Sub UnitPrice_AfterUpdate()
Dim pos As Variant
'Me.Dirty = False
End Sub
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
End Sub