Re: Not connecting to records
- From: "Michel Walsh" <vanderghast@VirusAreFunnierThanSpam>
- Date: Wed, 12 Jul 2006 18:03:54 -0400
Hi,
strSQL = "SELECT [Cash Part No], (various other fields)...[Special
Notes] "
strSQL = strSQL & "FROM [Query - Special Pricing Main & Individual] "
strSQL = strSQL & "WHERE (Cust_Cust_ID = '" & strCustomerNumber & "')"
if( 0 <> len(AcctNo & vbNullString) ) then
strSQL=strSQL & " AND [Acct_no] = " & AcctNo
end if
strSQL = strSQL & "ORDER BY [Cash Part No];"
which, basically, check to see if the there something in the control AcctNo
and if so, add the extra condition to the SQL string.
Hoping it may help,
Vanderghast, Access MVP
"ztyco" <ztyco@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:86F6859A-0751-4894-9EAD-93B2F4731F09@xxxxxxxxxxxxxxxx
Thank you so much Michel, I've gotten that working. However, after going
in
circles I have another problem and I believe I've figured out I can't "get
there from here". Could I ask for your guidance on one more question
please.
I "think" I may be making this harder than it should be and I'm just
tangled
up.
First of all...what I'm trying to do.
I have several account numbers from which I want to use the same price
sheet
(another assigned account number). So, I've created a query that works
just
fine and does that for me.
However, when I try to fill the list box it pulls based upon the below
code.
strSQL = "SELECT [Cash Part No], (various other fields)...[Special
Notes] "
strSQL = strSQL & "FROM [Query - Special Pricing Main & Individual] "
strSQL = strSQL & "WHERE (Cust_Cust_ID = '" & strCustomerNumber & "')"
strSQL = strSQL & "ORDER BY [Cash Part No];"
So, what it does is pull the special pricing based upon the Cust_Cust_ID
field. However, I need it to pull from the secondary field that has the
special pricing account number in it.
For instance.
Acct No Product Price List Acct Number
1 A 2
2 B 2
3 B 2
It pulls the account number data (matches "cust_cust_ID) and I want it to
pull all data that matches Price Llist Acct Number when I select any of
Acct
No 1, 2 or 3.
I hope this makes sense.
Thank ever so much.
Cindy
"Michel Walsh" wrote:
Hi,
In the "customer number" after update event, try something like:
strSQL= "SELECT ... " ' your query that list everything
If IsNull(Me.CustomerNumber) then
' do nothing
Else
strSQL = strSQL & " WHERE
coding=FORMS!FormNameHere!CustomerNumber "
End if
Me.ListBoxName.RowSource = strSQL
where I assumed you have a field name coding that must be filtered with
the
value supplied in the control CustomerNumber. You probably have to make
some
adaptation for your particular case, but the idea is just to write an SQL
statement, as a string, and to supply it to the RowSource property of
your
listbox. Just be sure your statement, supplied as a string, is correct
(such
as having spaces between key words, etc.
Hoping it may help,
Vanderghast, Access MVP
"ztyco" <ztyco@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7C804877-7136-40D8-B0FE-F143D4964162@xxxxxxxxxxxxxxxx
This is what I am trying to do....
Pull data from a query that is working beautifully -- to populate a
listbox.
When I double click a customer number and their coding is "SPC"
(special),
then I want it to populate the list box from the query with only those
records of the customer number selected. I have a customer number
field
on
the actual form and the list box in on the same form but a different
window.
Right now, what is occuring is that it pulls all records- it does not
filter
by the customer number. So, I get all special pricing for all
customers.
I
had this working in a prior version and have compared and compared and
compared and cannot seem to discern what has changed. Does anyone have
any
insight on this form?
Thank you every so much in advance!
.
- Follow-Ups:
- Re: Not connecting to records
- From: ztyco
- Re: Not connecting to records
- References:
- Re: Not connecting to records
- From: Michel Walsh
- Re: Not connecting to records
- From: ztyco
- Re: Not connecting to records
- Prev by Date: Re: What is the best way to create switchboards in Access?
- Next by Date: Tick boxes from list box
- Previous by thread: Re: Not connecting to records
- Next by thread: Re: Not connecting to records
- Index(es):
Relevant Pages
|