Undefined Function

J

jlute

Hi, there! I could use some help with a combo box. I'm trying to
populate it with another combo box and get the error: Undefined
Function. Here's the SQL for the combo box:

SELECT
FROM tblLocations
WHERE (((tblLocations.txtLocationID)=[cbCustomerName].Column(2)));

Do you see anything wrong with my code?

THANKS!
 
J

J_Goddard via AccessMonster.com

Hi -

Select WHAT from tblLocations? You need a field list after the SELECT.

John



Hi, there! I could use some help with a combo box. I'm trying to
populate it with another combo box and get the error: Undefined
Function. Here's the SQL for the combo box:

SELECT
FROM tblLocations
WHERE (((tblLocations.txtLocationID)=[cbCustomerName].Column(2)));

Do you see anything wrong with my code?

THANKS!

--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
 
J

jlute

Select WHAT from tblLocations?  You need a field list after the SELECT.

Hi, John. I cut the SQL down to be easier to read and didn't recognize
that that might throw things off:

SELECT qryLocIDsAddresses.txtLocID AS [Cust DC]
FROM tblLocations INNER JOIN (tblLocationsLocationIDs INNER JOIN
(tblLocationIDsAddresses INNER JOIN qryLocIDsAddresses ON
tblLocationIDsAddresses.numLocationAddressID =
qryLocIDsAddresses.numLocationAddressID) ON
tblLocationsLocationIDs.numLocID = tblLocationIDsAddresses.numLocID)
ON tblLocations.txtLocationID = tblLocationsLocationIDs.txtLocationID
GROUP BY qryLocIDsAddresses.txtLocID, tblLocations.txtLocationID
HAVING (((tblLocations.txtLocationID)=[cbCustomerName].Column(2)));

This works fine WITHOUT =[cbCustomerName].Column(2). The error
triggers when I add .Column(2).
 
J

J_Goddard via AccessMonster.com

Hi -

How many columns are in the combo box [cbCustomerName]? Did you remember
that .Column(2) refers to the *third* column?

John


Select WHAT from tblLocations?  You need a field list after the SELECT.

Hi, John. I cut the SQL down to be easier to read and didn't recognize
that that might throw things off:

SELECT qryLocIDsAddresses.txtLocID AS [Cust DC]
FROM tblLocations INNER JOIN (tblLocationsLocationIDs INNER JOIN
(tblLocationIDsAddresses INNER JOIN qryLocIDsAddresses ON
tblLocationIDsAddresses.numLocationAddressID =
qryLocIDsAddresses.numLocationAddressID) ON
tblLocationsLocationIDs.numLocID = tblLocationIDsAddresses.numLocID)
ON tblLocations.txtLocationID = tblLocationsLocationIDs.txtLocationID
GROUP BY qryLocIDsAddresses.txtLocID, tblLocations.txtLocationID
HAVING (((tblLocations.txtLocationID)=[cbCustomerName].Column(2)));

This works fine WITHOUT =[cbCustomerName].Column(2). The error
triggers when I add .Column(2).
 
C

Chris

Try [cbCustomerName].Column(2,[cbCustomerName].ListIndex)

If that doesn't work, try
[cbCustomerName].Column(1,[cbCustomerName].ListIndex) since column numbering
actually begins with 0 and not 1.



Select WHAT from tblLocations? You need a field list after the SELECT.

Hi, John. I cut the SQL down to be easier to read and didn't recognize
that that might throw things off:

SELECT qryLocIDsAddresses.txtLocID AS [Cust DC]
FROM tblLocations INNER JOIN (tblLocationsLocationIDs INNER JOIN
(tblLocationIDsAddresses INNER JOIN qryLocIDsAddresses ON
tblLocationIDsAddresses.numLocationAddressID =
qryLocIDsAddresses.numLocationAddressID) ON
tblLocationsLocationIDs.numLocID = tblLocationIDsAddresses.numLocID)
ON tblLocations.txtLocationID = tblLocationsLocationIDs.txtLocationID
GROUP BY qryLocIDsAddresses.txtLocID, tblLocations.txtLocationID
HAVING (((tblLocations.txtLocationID)=[cbCustomerName].Column(2)));

This works fine WITHOUT =[cbCustomerName].Column(2). The error
triggers when I add .Column(2).
 
M

Marshall Barton

Hi, there! I could use some help with a combo box. I'm trying to
populate it with another combo box and get the error: Undefined
Function. Here's the SQL for the combo box:

SELECT
FROM tblLocations
WHERE (((tblLocations.txtLocationID)=[cbCustomerName].Column(2)));


Queries do not recognize properties and methods that need
arguments in parenthesis.

I deal with this by adding a hidden text to the form and
using the first combo bex's AfterUpdate event to set the
text box's value before requerying the second combo box:
Me.hiddentextbox = Me.cbCustomerName.Column(2)
 
J

jlute

I deal with this by adding a hidden text to the form and
using the first combo bex's AfterUpdate event to set the
text box's value before requerying the second combo box:
        Me.hiddentextbox = Me.cbCustomerName.Column(2)

Thanks, Marshall! I actually considered this but wanted to pursue the
other method. I tried Chris' suggestions below but they returned the
same error. Thanks, Chris!

Anyway, I've used the hidden control trick and it works BUT
[cbCustomerDC] isn't requerying off the hidden control [hidLocID]
despite having the proper After Update event in [hidLocID]. Basically,
[cbCustomerDC] queries accordingly ONLY when I open the form and make
a selection in [cbCustomerName]. When I make another selection in
[cbCustomerName] it properly updates [hidLocID] but [cbCustomerDC]
doesn't requery.

Any ideas why? BTW all of the controls are unbound.
 
J

jlute

I deal with this by adding a hidden text to the form and
using the first combo bex's AfterUpdate event to set the
text box's value before requerying the second combo box:
        Me.hiddentextbox = Me.cbCustomerName.Column(2)

Thanks, Marshall! I actually considered this but wanted to pursue the
other method. I tried Chris' suggestions below but they returned the
same error. Thanks, Chris!

Anyway, I've used the hidden control trick and it works BUT
[cbCustomerDC] isn't requerying off the hidden control [hidLocID]
despite having the proper After Update event in [hidLocID]. Basically,
[cbCustomerDC] queries accordingly ONLY when I open the form and make
a selection in [cbCustomerName]. When I make another selection in
[cbCustomerName] it properly updates [hidLocID] but [cbCustomerDC]
doesn't requery.

Any ideas why? BTW all of the controls are unbound.

Whoops! I caught it. I forgot to add Me.cbCustomerDC.Requery to the
After Update Event of [cbCustomerName].

Thanks to everyone!
 

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