DoCmd Driving me Nuts!

  • Thread starter Thread starter Matt via AccessMonster.com
  • Start date Start date
M

Matt via AccessMonster.com

I have the following code on the dbl click event. It works great in another
database I created. However it returns a blank form when I use it in a new
database.

It should return the record with the matching DetailsID in frmEngLog. I only
have 5 records in my test database and there are all unique. When I execute
the code it opens the form but it's blank. HELP!

Private Sub DetailsID_DblClick(Cancel As Integer)
Dim stDocName As String
Dim strFilter As String

stDocName = "frmEngLog"
strFilter = "[DetailsID] = Forms!frmEngLog!DetailsID"

DoCmd.OpenForm stDocName, acNormal, , strFilter

End Sub
 
If DetailsID is numeric, try:

strFilter = "[DetailsID] = " & Forms!frmEngLog!DetailsID

If it's text, use

strFilter = "[DetailsID] = " & Chr$(34) & _
Forms!frmEngLog!DetailsID & Chr$(34)

or

strFilter = "[DetailsID] = '" & Forms!frmEngLog!DetailsID & "'"

Exagerated for clarity, the second one is

strFilter = "[DetailsID] = ' " & Forms!frmEngLog!DetailsID & " ' "
 
The following worked.

strFilter = "[DetailsID] = " & Me!DetailsID

Thanks for the help
If DetailsID is numeric, try:

strFilter = "[DetailsID] = " & Forms!frmEngLog!DetailsID

If it's text, use

strFilter = "[DetailsID] = " & Chr$(34) & _
Forms!frmEngLog!DetailsID & Chr$(34)

or

strFilter = "[DetailsID] = '" & Forms!frmEngLog!DetailsID & "'"

Exagerated for clarity, the second one is

strFilter = "[DetailsID] = ' " & Forms!frmEngLog!DetailsID & " ' "
I have the following code on the dbl click event. It works great in another
database I created. However it returns a blank form when I use it in a new
[quoted text clipped - 16 lines]
 

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

Back
Top