Bookmark problem Still

C

CF

I am still having problems where it can't find a record.
Can someone point what am I doing wrong?

I have a form which allows the user to make some changes
and allows them to open another form to make further
changes. The link between the 2 forms works fine.
However, I am not able to populate the form with the
customers information to allow the user to make changes.
The second form has many combo boxes and listboxes.
Any help would be much appreciated.


Private Sub chgAttr_Click()
On Error GoTo Err_chgAttr_Click
Dim UPI As String
If IsNull(Me.txtNUPI) = False Then
UPI = Me.txtNUPI
Else
UPI = Me.txtUPI
End If

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmStudentInfo"

stLinkCriteria = "[txtID]='" & UPI & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_chgAttr_Click:
Exit Sub

Err_chgAttr_Click:
MsgBox Err.Description
Resume Exit_chgAttr_Click

End Sub

code for second form:

Private Sub Form_Load()

If IsNull(Me.txtID) Then
If Forms!frmModify.Visible Then
Me.txtID = Forms!frmModify.UPI

Dim rst As Recordset
Dim strCriteria As String

Set rst = Me.RecordsetClone


strCriteria = "UPI = '" & Me.txtID & "'"
rst.FindFirst strCriteria
If rst.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst.Bookmark
End If
DataEntry = False
Me.Refresh
End If

End If
End Sub
 
Top