Forwarding a field to a new form

  • Thread starter Thread starter Jane
  • Start date Start date
J

Jane

Hi,
I'm sure this question has been asked but I cannot seem to find it.
I setup a search form to find my records in a list box. When I click on the
record, a new form pops up with the record so it can be edited.
My problem is that the record deplayed in the new form is not the one I
choose.
What am I doing wrong?
TIA
Jane
 
What is the code you are using to open the form? Are you
using the WHERE clause of the OpenForm command correctly?

The most usualy method is to put this search box in the
header of the form that will display the records and then
have the detail section display the selected one. The
combobox wizard can help you set this up.

Gary Miller
 
Thanks Gary.
I'm not using the where statement. here's the code:

Private Sub Command103_Click()
On Error GoTo Err_Command103_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmServices"

stLinkCriteria = "[WarrantyId]=" & Me![WarrantyId]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command103_Click:
Exit Sub

Err_Command103_Click:
MsgBox Err.Description
Resume Exit_Command103_Click

End Sub
 
Actually, you are using the WHERE clause. That is where your
strCriteria is going.

The code looks good unless 1) WarrantyID is not the name of
your listbox. 2) Your listbox is set to multiselect 3) Your
ID is not numeric in which case you need a single quote
around your variable call. Ex...

stLinkCriteria = "[WarrantyId]= '" & Me![WarrantyId] & "'"

Gary Miller

Jane said:
Thanks Gary.
I'm not using the where statement. here's the code:

Private Sub Command103_Click()
On Error GoTo Err_Command103_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmServices"

stLinkCriteria = "[WarrantyId]=" & Me![WarrantyId]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command103_Click:
Exit Sub

Err_Command103_Click:
MsgBox Err.Description
Resume Exit_Command103_Click

End Sub

"Gary Miller" <[email protected]> escribió en el mensaje
What is the code you are using to open the form? Are you
using the WHERE clause of the OpenForm command correctly?

The most usualy method is to put this search box in the
header of the form that will display the records and then
have the detail section display the selected one. The
combobox wizard can help you set this up.

Gary Miller

seem to
find it. box.
When I click on the be
edited. is
not the one I
 
WarrantyId is my carry over field name.

Gary Miller said:
Actually, you are using the WHERE clause. That is where your
strCriteria is going.

The code looks good unless 1) WarrantyID is not the name of
your listbox. 2) Your listbox is set to multiselect 3) Your
ID is not numeric in which case you need a single quote
around your variable call. Ex...

stLinkCriteria = "[WarrantyId]= '" & Me![WarrantyId] & "'"

Gary Miller

Jane said:
Thanks Gary.
I'm not using the where statement. here's the code:

Private Sub Command103_Click()
On Error GoTo Err_Command103_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmServices"

stLinkCriteria = "[WarrantyId]=" & Me![WarrantyId]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command103_Click:
Exit Sub

Err_Command103_Click:
MsgBox Err.Description
Resume Exit_Command103_Click

End Sub

"Gary Miller" <[email protected]> escribió en el mensaje
What is the code you are using to open the form? Are you
using the WHERE clause of the OpenForm command correctly?

The most usualy method is to put this search box in the
header of the form that will display the records and then
have the detail section display the selected one. The
combobox wizard can help you set this up.

Gary Miller

Hi,
I'm sure this question has been asked but I cannot seem to
find it.
I setup a search form to find my records in a list box.
When I click on the
record, a new form pops up with the record so it can be
edited.
My problem is that the record deplayed in the new form is
not the one I
choose.
What am I doing wrong?
TIA
Jane
 
The 'Me!' needs to refer to the name of your listbox in
order for this to work.

Gary Miller

Jane said:
WarrantyId is my carry over field name.

"Gary Miller" <[email protected]> escribió en el mensaje
Actually, you are using the WHERE clause. That is where your
strCriteria is going.

The code looks good unless 1) WarrantyID is not the name of
your listbox. 2) Your listbox is set to multiselect 3) Your
ID is not numeric in which case you need a single quote
around your variable call. Ex...

stLinkCriteria = "[WarrantyId]= '" & Me![WarrantyId] & "'"

Gary Miller

Jane said:
Thanks Gary.
I'm not using the where statement. here's the code:

Private Sub Command103_Click()
On Error GoTo Err_Command103_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmServices"

stLinkCriteria = "[WarrantyId]=" & Me![WarrantyId]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command103_Click:
Exit Sub

Err_Command103_Click:
MsgBox Err.Description
Resume Exit_Command103_Click

End Sub

"Gary Miller" <[email protected]> escribió en el mensaje
What is the code you are using to open the form? Are you
using the WHERE clause of the OpenForm command correctly?

The most usualy method is to put this search box in the
header of the form that will display the records and then
have the detail section display the selected one. The
combobox wizard can help you set this up.

Gary Miller

Hi,
I'm sure this question has been asked but I cannot seem to
find it.
I setup a search form to find my records in a
list
box.
When I click on the
record, a new form pops up with the record so it
can
be
edited.
My problem is that the record deplayed in the new
form
is
not the one I
choose.
What am I doing wrong?
TIA
Jane
 
Back
Top