Open form where criteria not working


I am using the following code to open a new window with selected criteria:

[code]Dim strForm As String
Dim strCriteria As String
Dim strTable As String
Dim strField As String

strTable = Me.cboSearch.Column(2)
strField = Me.cboSearch.Column(1)

Select Case strTable
Case "crm"
strForm = "frm_crm_customers"
strCriteria = "customerid = '" & strField & "'"
Case "el"
strForm = "frmelcustomers"
strCriteria = "id = '" & strField & "'"

End Select

DoCmd.OpenForm strForm, , , strCriteria, , acWindowNormal[/code]
It works fine and opens the the new window with the correct record showing, but when the code steps through to the exit sub it clears the data on the new window. There is no code on the on load or current on the new window.

Any ideas greatfully received.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!