473,386 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Looking for the right CRITERIA!

Hi!
I need to know where I go wrong:

On a frmItems I have a listbox that shows all items in tblItems.
Now the items is keys from different producers.
So I can have three identical keys:

OR-303 s,
WA-303 s,
FL-303 s
and so on...

My problem is that when I open the frmItems and have say...OR-303 s focused,
I have a button I can click and which is supposed to show me similar keys,
that is: 303 s, in the lstItemsInfo.

So, this is the code in the form's OnLoad event:

With Me.lstItemsInfo
.RowSource = ""
.ColumnCount = 4
.ColumnWidths = "0cm;10cm;2cm;2cm"
.ColumnHeads = True
.BoundColumn = 1
.RowSource = UCase("SELECT DISTINCTROW ItemID,ItemName,UnitPrice, EnvFee " _
& "FROM tblItems " _
& "ORDER BY ItemName;")
End With

And believe me, it works just fine! But...Yes I say BUT:

I'll try to write the following sql that hopefully will
change the listbox with new values when click on btnSIMILAR:

With Me.lstItemsInfo
.RowSource = ""
.ColumnCount = 4
.ColumnWidths = "0cm;10cm;2cm;2cm"
.ColumnHeads = True
.BoundColumn = 1
.RowSource = UCase("SELECT DISTINCTROW ItemID,ItemName,UnitPrice, EnvFee " _
& "FROM tblItems " _

'Now try to find similar keys that has 303 in the name

& "WHERE (((ItemName) LIKE Left(Forms!frmItems!txtItemName.Text,4))) " _

'What is the correct criteria?

& "ORDER BY ItemName;")
End With

So U see? I miss something in the criteria. U know what?

Hopefully Yours,

Me.Name

Private Sub Form_Close
With Me.lstItemsInfo
.Rowsource = ""
End With
end sub
Nov 13 '05 #1
2 1182
Geir Baardsen wrote:
Hi!
I need to know where I go wrong:

On a frmItems I have a listbox that shows all items in tblItems.
Now the items is keys from different producers.
So I can have three identical keys:

OR-303 s,
WA-303 s,
FL-303 s
and so on...

My problem is that when I open the frmItems and have say...OR-303 s focused,
I have a button I can click and which is supposed to show me similar keys,
that is: 303 s, in the lstItemsInfo.

So, this is the code in the form's OnLoad event:

With Me.lstItemsInfo
.RowSource = ""
.ColumnCount = 4
.ColumnWidths = "0cm;10cm;2cm;2cm"
.ColumnHeads = True
.BoundColumn = 1
.RowSource = UCase("SELECT DISTINCTROW ItemID,ItemName,UnitPrice, EnvFee " _
& "FROM tblItems " _
& "ORDER BY ItemName;")
End With

And believe me, it works just fine! But...Yes I say BUT:

I'll try to write the following sql that hopefully will
change the listbox with new values when click on btnSIMILAR:

With Me.lstItemsInfo
.RowSource = ""
.ColumnCount = 4
.ColumnWidths = "0cm;10cm;2cm;2cm"
.ColumnHeads = True
.BoundColumn = 1
.RowSource = UCase("SELECT DISTINCTROW ItemID,ItemName,UnitPrice, EnvFee " _
& "FROM tblItems " _

'Now try to find similar keys that has 303 in the name

& "WHERE (((ItemName) LIKE Left(Forms!frmItems!txtItemName.Text,4))) " _

'What is the correct criteria?

& "ORDER BY ItemName;")
End With

So U see? I miss something in the criteria. U know what?
You want all the 303s?

"Where ItemName Like '??-" & Mid(txtItemName,4,3) & "*'"
Hopefully Yours,

Me.Name
;-)
Private Sub Form_Close
With Me.lstItemsInfo
.Rowsource = ""
End With
end sub


I assume you have the prompt for parameter when closing the form then? :-)
Nov 13 '05 #2
> > Private Sub Form_Close
With Me.lstItemsInfo
.Rowsource = ""
End With
end sub


I assume you have the prompt for parameter when closing the form then? :-)

No prompt. Using ms access 2000. But the code suggestion you made, doesn't
work. Don't know why. Have tried to play with different variations, but
nothing seems to go. Have even tried: Me!lstItemsInfo instead of
Me.lstItemsInfo. Suggestions? : - )

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Nairb | last post by:
Any suggestions for a good LAMP reseller account? Taking quality/ price and bandwidth as the main criteria. I need to support 10 domains at present.
1
by: Epetruk | last post by:
Hello all, I'm sorry for the long post, but I think it's better if I'm as detailed as I can be so that I don't make a mistake in my choice and so that there's a clear understanding of to what...
2
by: David | last post by:
Hi, This is probably really simple but kinda has me stumped. I have taken over a data base and am looking to modify it to make it more user friendly. Currently, I have a Combo box with 4...
1
by: rodchar | last post by:
hey all, here's what i have to work with: i've got 3 drop-down lists 1 textbox for makeup my search critera for 1 table of records. when the user sets his criteria, gets a subset of records...
0
by: learner | last post by:
( I am not sure if this is the right group but I could find answer in other group) I have tried to use wscript online help (Script56.CHM), google , search msdn, newsgroup for without luck. ...
6
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as...
2
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.