Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Finding Records

Status
Not open for further replies.

Neak1

Computer
Sep 10, 2001
12
0
0
US
Hello Everyone,

I have two forms within Access. I have a combo boxes on both forms which lists SSN's. What I want to be able to do is when I select an SSN from the first form once I have saved that record I have a command button which opens the second form when I open the second form I have some code that looks for that SSN and pulls up the data for that SSN in the second form. But when I use the combo box on the second form to select another SSN and I use a command button to go back to the first form the SSN's don't match. It is only when I pull up the second form and try in go back to the first form I run into a problem with unmatched SSN's.

Here is the code that I use to find the SSN's when I go from the first form to the second form

I have tried to use the same concept for the first form but since the first form is already open/loaded I can't use this method.

Private Sub Form_Open(Cancel As Integer)
Dim getCAN As String

getCAN = Form_PILOT3.CAN
Me.RecordsetClone.FindFirst "[CAN] = '" & getCAN & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.cboSearching.SETFOCUS

End Sub

If anyone know of an easier way to do this or improvements that I can make with my code to solve the problem I would appreciate it.

Neaka


 
Replies continue below

Recommended for you

If you want your code to run when you switch forms you could put it in the form's ACTIVATE event.

I'm not sure that this will solve your problem, but maybe it will be a step in the right direction. Hope it helps.
 
Status
Not open for further replies.
Back
Top