By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

Open Form, based on a table, to specific record from another form

P: n/a
I have a LOANS table that has a list of loan details for different
borrowers. I have a main switchboard with a LOANSELECT combo box
(that displays a list of borrower last names and loan numbers). I'd
like to be able to have a user click on the say, RECEIVE PAYMENT
button that will open the payments form. This form should open to the
loan that was selected from the LOANSELECT box. This form also has a
box on it to switch to different loan, so I can't use a query or a
DoCmd.OpenForm, as this only passes the selected record to the second
form.

I've been trying to get the FindFirst command to work, but can't seem
to do it. Here's what I've got as code for the second form.

Private Sub Form_Load()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LoanID] = " & Str(Nz(Forms!SWITCHBOARD.LoanSelect,
0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I greatly appreciate any help that anyone can give and forgive my
novice ability. Thanks!

Apr 29 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Is [LoanID] a number or a string?

Markus_989 wrote:
>I have a LOANS table that has a list of loan details for different
borrowers. I have a main switchboard with a LOANSELECT combo box
(that displays a list of borrower last names and loan numbers). I'd
like to be able to have a user click on the say, RECEIVE PAYMENT
button that will open the payments form. This form should open to the
loan that was selected from the LOANSELECT box. This form also has a
box on it to switch to different loan, so I can't use a query or a
DoCmd.OpenForm, as this only passes the selected record to the second
form.

I've been trying to get the FindFirst command to work, but can't seem
to do it. Here's what I've got as code for the second form.

Private Sub Form_Load()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LoanID] = " & Str(Nz(Forms!SWITCHBOARD.LoanSelect,
0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I greatly appreciate any help that anyone can give and forgive my
novice ability. Thanks!
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200704/1

Apr 29 '07 #2

P: n/a
Is [LoanID] a number or a string?

Markus_989 wrote:
>I have a LOANS table that has a list of loan details for different
borrowers. I have a main switchboard with a LOANSELECT combo box
(that displays a list of borrower last names and loan numbers). I'd
like to be able to have a user click on the say, RECEIVE PAYMENT
button that will open the payments form. This form should open to the
loan that was selected from the LOANSELECT box. This form also has a
box on it to switch to different loan, so I can't use a query or a
DoCmd.OpenForm, as this only passes the selected record to the second
form.

I've been trying to get the FindFirst command to work, but can't seem
to do it. Here's what I've got as code for the second form.

Private Sub Form_Load()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LoanID] = " & Str(Nz(Forms!SWITCHBOARD.LoanSelect,
0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I greatly appreciate any help that anyone can give and forgive my
novice ability. Thanks!
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200704/1

Apr 29 '07 #3

P: n/a
On Apr 29, 3:36 pm, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
Is [LoanID] a number or a string?

Markus_989 wrote:
I have a LOANS table that has a list of loan details for different
borrowers. I have a main switchboard with a LOANSELECT combo box
(that displays a list of borrower last names and loan numbers). I'd
like to be able to have a user click on the say, RECEIVE PAYMENT
button that will open the payments form. This form should open to the
loan that was selected from the LOANSELECT box. This form also has a
box on it to switch to different loan, so I can't use a query or a
DoCmd.OpenForm, as this only passes the selected record to the second
form.
I've been trying to get the FindFirst command to work, but can't seem
to do it. Here's what I've got as code for the second form.
Private Sub Form_Load()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[LoanID] = " & Str(Nz(Forms!SWITCHBOARD.LoanSelect,
0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
I greatly appreciate any help that anyone can give and forgive my
novice ability. Thanks!

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...- Hide quoted text -

- Show quoted text -
[LoanID] is an Autonumber from the LOANS table.

Apr 30 '07 #4

P: n/a
There are several ways to achieve what you want and you are using one of them.
Why not put a MsgBox in your next form and see what you are looking up?

MsgBox Str(Nz(Forms!SWITCHBOARD.LoanSelect,0))


Markus_989 wrote:
>On Apr 29, 3:36 pm, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
>Is [LoanID] a number or a string?
[quoted text clipped - 31 lines]
>>
- Show quoted text -

[LoanID] is an Autonumber from the LOANS table.
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

Apr 30 '07 #5

P: n/a
On Apr 30, 9:05 am, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
There are several ways to achieve what you want and you are using one of them.
Why not put a MsgBox in your next form and see what you are looking up?

MsgBox Str(Nz(Forms!SWITCHBOARD.LoanSelect,0))

Markus_989 wrote:
On Apr 29, 3:36 pm, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
Is [LoanID] a number or a string?
[quoted text clipped - 31 lines]
- Show quoted text -
[LoanID] is an Autonumber from the LOANS table.

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted viahttp://www.accessmonster.com
I've done that and it returns the correct value (the LoanID from the
prior form). I just can't seem to get the FindFirst line to work
correctly. I always just retuns the first field in the Loans table...

May 1 '07 #6

P: n/a
Use DAO:

Private Sub Form_Load()

' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[LoanID] = " & Str(Nz(Forms!SWITCHBOARD.
LoanSelect,
0))
If Not Me.RecordsetClone.NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
End If

End Sub
Markus_989 wrote:
>On Apr 30, 9:05 am, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
>There are several ways to achieve what you want and you are using one of them.
Why not put a MsgBox in your next form and see what you are looking up?
[quoted text clipped - 16 lines]
>>
Message posted viahttp://www.accessmonster.com

I've done that and it returns the correct value (the LoanID from the
prior form). I just can't seem to get the FindFirst line to work
correctly. I always just retuns the first field in the Loans table...
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

May 1 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.