Open form to specific record to edit (1 Viewer)

brian0721

Registered User.
Local time
Today, 22:34
Joined
Dec 5, 2001
Messages
103
Open form to specific record to edit... shouldn't be this hard...lol

Okay, I have a form that contains information, including a field "Borrower" On another form is a combo box that stores all the Borrowers. Ive done this before with reports, but not with forms. I want to be able to go back into the form and have it open to the specific borrower rather then record one. I must be overlooking something really simple. Please help!

Thanks a ton!
 

jfgambit

Kinetic Card Dealer
Local time
Today, 22:34
Joined
Jul 18, 2002
Messages
798
Add this to a command button or to the After Update event of the combobox.

DoCmd.OpenForm "FormName", , , "[Borrower] = " & Me.cboBorrower

HTH
 

brian0721

Registered User.
Local time
Today, 22:34
Joined
Dec 5, 2001
Messages
103
jfgambit said:
Add this to a command button or to the After Update event of the combobox.

DoCmd.OpenForm "FormName", , , "[Borrower] = " & Me.cboBorrower

HTH

That's what I tried at first and I just tried it again, and it does not work. It opens up the form, but with no information.

Any other advice?
 

Mile-O

Back once again...
Local time
Today, 22:34
Joined
Dec 10, 2002
Messages
11,316
Is Borrower a numeric field?
 

Mile-O

Back once again...
Local time
Today, 22:34
Joined
Dec 10, 2002
Messages
11,316
The code you have treats it as if it's a number

Remember:

  • Numeric

    Code:
    DoCmd.OpenForm "FormName", , , "[Borrower] = " & Me.cboBorrower

  • Text


    Code:
    DoCmd.OpenForm "FormName", , , "[Borrower] = """ & Me.cboBorrower & """"
  • Date

    Code:
    DoCmd.OpenForm "FormName", , , "[Borrower] = #" & Me.cboBorrower & "#"
 

jfgambit

Kinetic Card Dealer
Local time
Today, 22:34
Joined
Jul 18, 2002
Messages
798
Mile-O has posted all the options...what a guy!

I had just assumed that Borrower was an ID field...

:D
 

brian0721

Registered User.
Local time
Today, 22:34
Joined
Dec 5, 2001
Messages
103
you guys rock!

jfgambit said:
Mile-O has posted all the options...what a guy!

:D

thanks a ton guys, don't know what i'd do without this forum!
 

brian0721

Registered User.
Local time
Today, 22:34
Joined
Dec 5, 2001
Messages
103
ok...actually that isnt' working for me. it is opening up a blank record that is filitered?

am i doing something wrong?

thanks!
 

brian0721

Registered User.
Local time
Today, 22:34
Joined
Dec 5, 2001
Messages
103
jfgambit said:
Post the code...

Numeric

Code:
DoCmd.OpenForm "FormName", , , "[Borrower] = " & Me.cboBorrower

Text


Code:
DoCmd.OpenForm "FormName", , , "[Borrower] = """ & Me.cboBorrower & """"Date

Code:
DoCmd.OpenForm "FormName", , , "[Borrower] = #" & Me.cboBorrower & "#"

I am trying to get the Text code to work
 

jfgambit

Kinetic Card Dealer
Local time
Today, 22:34
Joined
Jul 18, 2002
Messages
798
Sorry B....did not make myself clear...I can see the code that is posted above. I want you to post the code exactly as you have it in your database. Copy the code from the module and paste it here:

Should look something like this:

Code:
Private Sub cmdPNSUB_Click()

DoCmd.OpenForm "NameofForm", , , "[Borrower] = '" & Me.Borrower & "'"

End Sub
 

brian0721

Registered User.
Local time
Today, 22:34
Joined
Dec 5, 2001
Messages
103
jfgambit said:
Sorry B....did not make myself clear...I can see the code that is posted above. I want you to post the code exactly as you have it in your database.

No prob...

DoCmd.OpenForm "gfe form", , , "[Borrower] = """ & Me.combo2 & """"
 

jfgambit

Kinetic Card Dealer
Local time
Today, 22:34
Joined
Jul 18, 2002
Messages
798
Code:
DoCmd.OpenForm "gfe form", , , "[Borrower] = """ & Me.combo2 & """"

If Borrower is a text fields then you need to change the """ to "'" <--single quote, not double:

Use this:
Code:
DoCmd.OpenForm "gfe form", , , "[Borrower] = "'" & Me.combo2 & "'"
 

brian0721

Registered User.
Local time
Today, 22:34
Joined
Dec 5, 2001
Messages
103
jfgambit said:
Use this:
Code:
DoCmd.OpenForm "gfe form", , , "[Borrower] = "'" & Me.combo2 & "'"

This gives me an error: "reserved error" Weird, I don't get it
 

Users who are viewing this thread

Top Bottom