Howto carryon a record 2 a new form

  • Thread starter Thread starter Luisa
  • Start date Start date
L

Luisa

Hello,
I use a como box to search for my records which are displayed into a list
box. Once I select the found record, I would like to go to a form where I
can edit it.
Currently I do go to the editing form but the found record is not carried
over.
How would I do that?
Thank you.
Luisa
 
Are you using Docmd.OpenForm to open the new form is so try

DoCmd.OpenForm "EditForm", , ,"RecordID = " & Forms!SearForm.NameOfComboBox

If your search box contains text use

DoCmd.OpenForm "EditForm", , ,"RecordID = '" & Forms!SearForm.NameOfComboBox
& "'"

Kelvin Lu
 
Thank you Kelvin,
Below is the what I have. I tried your suggestion but is not working.
Perhaps, I'm still doing some wrong.


***************************
Private Sub Comando12_Click()

On Error GoTo Err_Command12_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmMemoEdit"

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

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub
****************************************
 
when you use the Me operator, you need to use a period not the exclamation
point. That should fix the problem.

Kelvin Lu

Luisa said:
Thank you Kelvin,
Below is the what I have. I tried your suggestion but is not working.
Perhaps, I'm still doing some wrong.


***************************
Private Sub Comando12_Click()

On Error GoTo Err_Command12_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmMemoEdit"

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

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub
****************************************


Kelvin said:
Are you using Docmd.OpenForm to open the new form is so try

DoCmd.OpenForm "EditForm", , ,"RecordID = " & Forms!SearForm.NameOfComboBox

If your search box contains text use

DoCmd.OpenForm "EditForm", , ,"RecordID = '" & Forms!SearForm.NameOfComboBox
& "'"

Kelvin Lu
where
 
Back
Top