Open Form

  • Thread starter Thread starter Johnny
  • Start date Start date
J

Johnny

Hi,

I am trying to get into my code an expression syntax that when the from
opens it clears the form for new data to be entered. In the line
doCmd.OpenForm stDocName, , , stLinkCriteria at the end of this
statement is where I wanted to add the acaddform syntax but when I do
and open the form and fill in the data and then close and save it does
not save the data. If I take the syntax out of the statement and open
the form and enter the data and then close it saves the data for me. I
am needing find the expression that will allow the data to be saved.

Thanks
Johnny

Private Sub Command30_Click()
On Error GoTo Err_Command30_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "OrderMain"

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

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
 
acFormAdd not acAddForm.

Not sure if this is really your problem or you just had a typo in your post.

HTH,
 
You need to check the set-up of the Form "OrderMain". What you posted does
not seem to be related to ability of the Form "OrderMain" to save Records or
not.
 
Back
Top