Code behind command buttons

BobJ

Kestrel - Crawley
Local time
Yesterday, 17:44
Joined
Mar 22, 2007
Messages
47
On my order form i have 4 command buttons, 3 for dates and 1 for a notes section. i have some code for this, but it seems when i enter data in the new form / calendar a new entry is created in my Orders table when it should be part of the order being entered.

this is the code i currently am using:

Private Sub OrderDate1_Click()
On Error GoTo Err_OrderDate1_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "OrderDateCal"

stLinkCriteria = "[OrderID]=" & Me![OrderID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OrderDate1_Click:
Exit Sub

Err_OrderDate1_Click:
MsgBox Err.Description
Resume Exit_OrderDate1_Click

End Sub

how can i make it store the info in the current order!?
 
Using the WhereCondition argument simply puts a filter on the next form and if the filter criteria does not exist then you will get a new record. If you have not saved the current record then it cannot find it yet. Try saving the record before opening the next form.
DoCmd.RunCommand acCmdSaveRecord
 
cheers mate worked perfectly
 

Users who are viewing this thread

Back
Top Bottom