Open form from record in list using Allen Browne's search form

G

Guest

I am using Allen Brown's search form in a db and it works great. I want to
double click on a record in the detail of the form and open my data entry
form to that record. Can someone tell me how to accomplish this. I tried
the code below, but it wouldn't work, it keeps asking me for an = sign says
missing expression.

Thanks in advance.

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "item" form at the
selected record for edit

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "tblItems.ItemNumber =" &
[Forms]![frmSearch]![tblItems.ItemNumber], acFormEdit
DoCmd.Close acForm, strThisForm,)
 
G

Guest

Try this:

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[ItemNumber] =" & Me.ItemNumber, acFormEdit
DoCmd.Close acForm, strThisForm

Steve
 
G

Guest

That did it.

Thanks SteveM

SteveM said:
Try this:

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[ItemNumber] =" & Me.ItemNumber, acFormEdit
DoCmd.Close acForm, strThisForm

Steve

Jerry in the Desert. said:
I am using Allen Brown's search form in a db and it works great. I want to
double click on a record in the detail of the form and open my data entry
form to that record. Can someone tell me how to accomplish this. I tried
the code below, but it wouldn't work, it keeps asking me for an = sign says
missing expression.

Thanks in advance.

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "item" form at the
selected record for edit

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "tblItems.ItemNumber =" &
[Forms]![frmSearch]![tblItems.ItemNumber], acFormEdit
DoCmd.Close acForm, strThisForm,)
 
D

dgodfrey

I have tried using this code to do the same thing...problem is, I am getting
errors because I cannot figure out what to put in the place of "ItemNumber"
from my own database...I am currently getting a form is misspelled or doesn't
exist error (2102).

Here is what I currently have it set at:

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "BOLO" form at the
selected record for edit
Dim stDocName As String
Dim strEmployeeID As String
Dim strThisForm As String
stDocName = "frmBolo"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[EmployeeID] =" & Me.EmployeeID, acFormEdit
DoCmd.Close acForm, strThisForm
End Sub

I am using the northwinds sample database with teh "employees" form and
table renamed to "Bolo".

Thanks.

SteveM said:
Try this:

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[ItemNumber] =" & Me.ItemNumber, acFormEdit
DoCmd.Close acForm, strThisForm

Steve

Jerry in the Desert. said:
I am using Allen Brown's search form in a db and it works great. I want to
double click on a record in the detail of the form and open my data entry
form to that record. Can someone tell me how to accomplish this. I tried
the code below, but it wouldn't work, it keeps asking me for an = sign says
missing expression.

Thanks in advance.

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "item" form at the
selected record for edit

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "tblItems.ItemNumber =" &
[Forms]![frmSearch]![tblItems.ItemNumber], acFormEdit
DoCmd.Close acForm, strThisForm,)
 
D

dgodfrey

Found my problem. I had mismatched form names. I also discovered I had to
change "ItemNumber" to "BoloNumber", which is the primary key and an
autonumber. Not sure why? I am still new to this.

dgodfrey said:
I have tried using this code to do the same thing...problem is, I am getting
errors because I cannot figure out what to put in the place of "ItemNumber"
from my own database...I am currently getting a form is misspelled or doesn't
exist error (2102).

Here is what I currently have it set at:

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "BOLO" form at the
selected record for edit
Dim stDocName As String
Dim strEmployeeID As String
Dim strThisForm As String
stDocName = "frmBolo"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[EmployeeID] =" & Me.EmployeeID, acFormEdit
DoCmd.Close acForm, strThisForm
End Sub

I am using the northwinds sample database with teh "employees" form and
table renamed to "Bolo".

Thanks.

SteveM said:
Try this:

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[ItemNumber] =" & Me.ItemNumber, acFormEdit
DoCmd.Close acForm, strThisForm

Steve

Jerry in the Desert. said:
I am using Allen Brown's search form in a db and it works great. I want to
double click on a record in the detail of the form and open my data entry
form to that record. Can someone tell me how to accomplish this. I tried
the code below, but it wouldn't work, it keeps asking me for an = sign says
missing expression.

Thanks in advance.

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "item" form at the
selected record for edit

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "tblItems.ItemNumber =" &
[Forms]![frmSearch]![tblItems.ItemNumber], acFormEdit
DoCmd.Close acForm, strThisForm,)
 
E

Emine

I too have am using the contact finder from Allen Brown. I also would like
to double click on any record(s) that have been found and be able to go
directly to that record for editing purposes. I'm just not sure how to edit
the code so that it works for my forms. I keep getting Run Time error 2102.

This is my code:

Private Sub Student_Last_Name_DblClick(Cancel As Integer)
Dim stStudent As String
Dim strItemNumber As String
Dim strThisForm As String
stStudent = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stStudent, , , "[StudentID] =" & Me.StudentID, acFormEdit
DoCmd.Close acForm, strThisForm

End Sub

Can someone please tell me what it is I'm doing wrong. Thank you so much!!!


SteveM said:
Try this:

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[ItemNumber] =" & Me.ItemNumber, acFormEdit
DoCmd.Close acForm, strThisForm

Steve

Jerry in the Desert. said:
I am using Allen Brown's search form in a db and it works great. I want to
double click on a record in the detail of the form and open my data entry
form to that record. Can someone tell me how to accomplish this. I tried
the code below, but it wouldn't work, it keeps asking me for an = sign says
missing expression.

Thanks in advance.

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "item" form at the
selected record for edit

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "tblItems.ItemNumber =" &
[Forms]![frmSearch]![tblItems.ItemNumber], acFormEdit
DoCmd.Close acForm, strThisForm,)
 
E

Emine

SORRY DISREGARD MY LAST THREAD! Works like a charm with the exception of
that it does not go to that specified record, it only opens the form. What
do I do now. Thanks guys!

Emine said:
I too have am using the contact finder from Allen Brown. I also would like
to double click on any record(s) that have been found and be able to go
directly to that record for editing purposes. I'm just not sure how to edit
the code so that it works for my forms. I keep getting Run Time error 2102.

This is my code:

Private Sub Student_Last_Name_DblClick(Cancel As Integer)
Dim stStudent As String
Dim strItemNumber As String
Dim strThisForm As String
stStudent = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stStudent, , , "[StudentID] =" & Me.StudentID, acFormEdit
DoCmd.Close acForm, strThisForm

End Sub

Can someone please tell me what it is I'm doing wrong. Thank you so much!!!


SteveM said:
Try this:

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[ItemNumber] =" & Me.ItemNumber, acFormEdit
DoCmd.Close acForm, strThisForm

Steve

Jerry in the Desert. said:
I am using Allen Brown's search form in a db and it works great. I want to
double click on a record in the detail of the form and open my data entry
form to that record. Can someone tell me how to accomplish this. I tried
the code below, but it wouldn't work, it keeps asking me for an = sign says
missing expression.

Thanks in advance.

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "item" form at the
selected record for edit

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "tblItems.ItemNumber =" &
[Forms]![frmSearch]![tblItems.ItemNumber], acFormEdit
DoCmd.Close acForm, strThisForm,)
 
E

Emine

OK I FIGURED IT OUT! WOW I learn more and more from this place. THANK YOU
SO MUCH GUYS!

Emine said:
I too have am using the contact finder from Allen Brown. I also would like
to double click on any record(s) that have been found and be able to go
directly to that record for editing purposes. I'm just not sure how to edit
the code so that it works for my forms. I keep getting Run Time error 2102.

This is my code:

Private Sub Student_Last_Name_DblClick(Cancel As Integer)
Dim stStudent As String
Dim strItemNumber As String
Dim strThisForm As String
stStudent = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stStudent, , , "[StudentID] =" & Me.StudentID, acFormEdit
DoCmd.Close acForm, strThisForm

End Sub

Can someone please tell me what it is I'm doing wrong. Thank you so much!!!


SteveM said:
Try this:

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "[ItemNumber] =" & Me.ItemNumber, acFormEdit
DoCmd.Close acForm, strThisForm

Steve

Jerry in the Desert. said:
I am using Allen Brown's search form in a db and it works great. I want to
double click on a record in the detail of the form and open my data entry
form to that record. Can someone tell me how to accomplish this. I tried
the code below, but it wouldn't work, it keeps asking me for an = sign says
missing expression.

Thanks in advance.

Private Sub Form_DblClick(Cancel As Integer) 'Opens the "item" form at the
selected record for edit

Dim stDocName As String
Dim strItemNumber As String
Dim strThisForm As String
stDocName = "frmItem"
strThisForm = "frmSearch"
DoCmd.OpenForm stDocName, , , "tblItems.ItemNumber =" &
[Forms]![frmSearch]![tblItems.ItemNumber], acFormEdit
DoCmd.Close acForm, strThisForm,)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top