Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Double Click List Box

Geek News

Double Click List Box
"CJ" <private[ at ]newsgroups.com> 11/14/2008 8:07:54 PM
Hi Groupies:

I am trying to open another form when I double click an item in a listbox.
However, I keep getting a parameter error. I don't understand why I am
getting this error because the field on the form I am trying to open is
definitely called SKU Number. The good news is that the parameter shows that
it has the correct value selected but when I click OK the form opens up
empty.
Here is my code:

Private Sub lstTruckInventory_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmInventory"

stLinkCriteria = "[SKU Number]= " & Me.lstTruckInventory.Column(0)
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub


Could somebody please fix this for me?

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!

Re: Double Click List Box
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> 11/14/2008 8:14:11 PM
Is SKU Number a text field? If so, you need quotes around the value:

stLinkCriteria = "[SKU Number]= '" & Me.lstTruckInventory.Column(0) & "'"

Exagerated for clarity, that's

stLinkCriteria = "[SKU Number]= ' " & Me.lstTruckInventory.Column(0) & " ' "

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"CJ" <private[ at ]newsgroups.com> wrote in message
news:31DE766E-8B1B-4DE6-94D2-6C86C04B716D[ at ]microsoft.com...
[Quoted Text]
> Hi Groupies:
>
> I am trying to open another form when I double click an item in a listbox.
> However, I keep getting a parameter error. I don't understand why I am
> getting this error because the field on the form I am trying to open is
> definitely called SKU Number. The good news is that the parameter shows
> that it has the correct value selected but when I click OK the form opens
> up empty.
> Here is my code:
>
> Private Sub lstTruckInventory_DblClick(Cancel As Integer)
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "frmInventory"
>
> stLinkCriteria = "[SKU Number]= " & Me.lstTruckInventory.Column(0)
> DoCmd.OpenForm stDocName, , , stLinkCriteria
> End Sub
>
>
> Could somebody please fix this for me?
>
> --
> Thanks for taking the time!
>
> CJ
> ---------------------------------------------------------
> Know thyself, know thy limits....know thy newsgroups!


Re: Double Click List Box
"CJ" <private[ at ]newsgroups.com> 11/14/2008 8:33:23 PM
I had tried the quote thing but I obviously had not done it correctly.

Thanks a bunch Doug!

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> wrote in message
news:O15OQWpRJHA.1172[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
> Is SKU Number a text field? If so, you need quotes around the value:
>
> stLinkCriteria = "[SKU Number]= '" & Me.lstTruckInventory.Column(0) & "'"
>
> Exagerated for clarity, that's
>
> stLinkCriteria = "[SKU Number]= ' " & Me.lstTruckInventory.Column(0) & " '
> "
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "CJ" <private[ at ]newsgroups.com> wrote in message
> news:31DE766E-8B1B-4DE6-94D2-6C86C04B716D[ at ]microsoft.com...
>> Hi Groupies:
>>
>> I am trying to open another form when I double click an item in a
>> listbox. However, I keep getting a parameter error. I don't understand
>> why I am getting this error because the field on the form I am trying to
>> open is definitely called SKU Number. The good news is that the parameter
>> shows that it has the correct value selected but when I click OK the form
>> opens up empty.
>> Here is my code:
>>
>> Private Sub lstTruckInventory_DblClick(Cancel As Integer)
>> Dim stDocName As String
>> Dim stLinkCriteria As String
>>
>> stDocName = "frmInventory"
>>
>> stLinkCriteria = "[SKU Number]= " & Me.lstTruckInventory.Column(0)
>> DoCmd.OpenForm stDocName, , , stLinkCriteria
>> End Sub
>>
>>
>> Could somebody please fix this for me?
>>
>> --
>> Thanks for taking the time!
>>
>> CJ
>> ---------------------------------------------------------
>> Know thyself, know thy limits....know thy newsgroups!
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net