Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programming Acess Subforms-How can I edit subforms

Status
Not open for further replies.

fungua

Programmer
Jul 2, 2003
2
US
I have an OrderEntry form whose main part contains as main features, the following: CustomerPO, OrderID, ItemType and ItemCount,
a continue button and a finish button and a subform.

To enter a new Order, we first enter a new orderID and then hit the continue button. This opens up the appropriate Order form (e.g Metal Order Form or Wood Order Form) passing the new OrderID and Item Count to it. Once the OrderDetails are entered in the Metal Order Form, the user hits the AddItem button and this does two main things:
1.It enters the values in the relevant tables
2.Increases the ItemCount by one and opens the OrderEntry Form with this updated value.
3. The Subform now should countain the details of the item just entered.

To enter the next item in the same order, the user simply
selects the next item type, types continue and repeats the process. The subform should reflect the newly added item.

This has worked perfectly till now when I have been required to allow overwriting of the unit prices that are shown in the subform. I can't do this because all my fields in the subform seem locked.
When this price is overwritten I should be able to use an event to respond appropriately.

Here is the code that I am using to populate the subform:
Public Sub DisplayOrder(ByVal OrderCode)
Dim CommandString As String
Dim rs As ADODB.Recordset

CommandString = "SELECT Qty, Description, UnitCost, TotalCost " & vbCrLf & _
"FROM OrderItems" & vbCrLf & _
"WHERE (OrderID ='" & OrderCode & "')"
Set rs = New ADODB.Recordset
rs.Open CommandString & "", CurrentProject.Connection, adOpenKeyset, _
adLockReadOnly, adCmdText
Set Forms![EnterOrder]![frmMetalOrderDescription].Form.Recordset = rs
Forms![EnterOrder]![frmMetalOrderDescription].Form![Qty].ControlSource = "Qty"
Forms![EnterOrder]![frmMetalOrderDescription].Form![Description].ControlSource = "Description"
Forms![EnterOrder]![frmMetalOrderDescription].Form![UnitCost].ControlSource = "UnitCost"
Forms![EnterOrder]![frmMetalOrderDescription].Form![TotalCost].ControlSource = "TotalCost"
rs.Close
Me.frmMetalOrderDescription.Visible = True

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top