G
Gibson
I am using the following code to open up a recordset, add a record then open
a form based upon that table.
Dim rsImp As ADODB.Recordset
Dim SQLStmnt As String
strNewData = NewData
SQLStmnt = "SELECT * FROM flkp1 WHERE Field1 = '" & strNewData &
"'"
Set rsImp = New ADODB.Recordset
rsImp.Open SQLStmnt, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
If rsImp.EOF Then
rsImp.AddNew
rsImp![Field1] = strNewImp
rsImp.Update
End If
rsImp.Close
Set rsImp = Nothing
DoCmd.OpenForm "frm1", acNormal, "", "", , , "Field1 =
strNewData"
The record is added fine but the form opens to the most recent record, not
the record whose Field1 value is equal to strNewData. Field 1 is the key
field in the table. Any ideas?
Thanks
a form based upon that table.
Dim rsImp As ADODB.Recordset
Dim SQLStmnt As String
strNewData = NewData
SQLStmnt = "SELECT * FROM flkp1 WHERE Field1 = '" & strNewData &
"'"
Set rsImp = New ADODB.Recordset
rsImp.Open SQLStmnt, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
If rsImp.EOF Then
rsImp.AddNew
rsImp![Field1] = strNewImp
rsImp.Update
End If
rsImp.Close
Set rsImp = Nothing
DoCmd.OpenForm "frm1", acNormal, "", "", , , "Field1 =
strNewData"
The record is added fine but the form opens to the most recent record, not
the record whose Field1 value is equal to strNewData. Field 1 is the key
field in the table. Any ideas?
Thanks