PC Review


Reply
Thread Tools Rate Thread

Cascading Combo Boxes w/ SQL in a PRoject

 
 
pltaylor3@gmail.com
Guest
Posts: n/a
 
      7th Nov 2006
For some reason I cannot get this code to create my cascading combo
box.

SELECT EngineNumber FROM dbo.Engine
Where(((Program)=[forms]![Selection]![prgrm]))

This is pulling information from a SQL database that the form is linked
to and it gives me the error "Incorrect Syntax near '!'" the names of
the access value are correct and the query works when i stick a value
for prgrm in place of the "[forms]![Selection]![prgrm]"
any help would be greatly appreciated.
thanks

 
Reply With Quote
 
 
 
 
kingston via AccessMonster.com
Guest
Posts: n/a
 
      7th Nov 2006
Try this:

SELECT EngineNumber FROM dbo.Engine
Where(((Program)='" & [forms]![Selection]![prgrm] & "'"))

(E-Mail Removed) wrote:
>For some reason I cannot get this code to create my cascading combo
>box.
>
>SELECT EngineNumber FROM dbo.Engine
>Where(((Program)=[forms]![Selection]![prgrm]))
>
>This is pulling information from a SQL database that the form is linked
>to and it gives me the error "Incorrect Syntax near '!'" the names of
>the access value are correct and the query works when i stick a value
>for prgrm in place of the "[forms]![Selection]![prgrm]"
>any help would be greatly appreciated.
>thanks


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1

 
Reply With Quote
 
pltaylor3@gmail.com
Guest
Posts: n/a
 
      8th Nov 2006
That leads to an empty combo box. I am open to suggestions. I believe
it is passing the value & [forms]![Selection]![prgrm] & instead of what
that value should represent (i.e. the value in the text box prgrm).




kingston via AccessMonster.com wrote:
> Try this:
>
> SELECT EngineNumber FROM dbo.Engine
> Where(((Program)='" & [forms]![Selection]![prgrm] & "'"))
>
> (E-Mail Removed) wrote:
> >For some reason I cannot get this code to create my cascading combo
> >box.
> >
> >SELECT EngineNumber FROM dbo.Engine
> >Where(((Program)=[forms]![Selection]![prgrm]))
> >
> >This is pulling information from a SQL database that the form is linked
> >to and it gives me the error "Incorrect Syntax near '!'" the names of
> >the access value are correct and the query works when i stick a value
> >for prgrm in place of the "[forms]![Selection]![prgrm]"
> >any help would be greatly appreciated.
> >thanks

>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...ccess/200611/1


 
Reply With Quote
 
kingston via AccessMonster.com
Guest
Posts: n/a
 
      8th Nov 2006
Verify that [forms]![Selection]![prgrm] returns the value in the control.
Enter something in the control (remember to press the Enter key after putting
in a value). Then open the form where the combo box resides. If the two are
in the same form, requery the combo box after the input control is updated:

DoCmd Me.ComboBox.Requery

If [forms]![Selection]![prgrm] doesn't return anything, check the name of the
form and the control. You can also verify this by entering something in the
control, then typing Crtl+g. In the results pane (bottom) of the programming
window, type ?[forms]![Selection]![prgrm]. It should return what is in the
control.

The query I supplied assumes that the field [Program] is a text field. If it
is a numerical field, remove the single quotes in the expression. Also, this
might be failing if you are working with subforms. If the input control is
in a subform, it needs to be referenced differently.

(E-Mail Removed) wrote:
>That leads to an empty combo box. I am open to suggestions. I believe
>it is passing the value & [forms]![Selection]![prgrm] & instead of what
>that value should represent (i.e. the value in the text box prgrm).
>
>> Try this:
>>

>[quoted text clipped - 17 lines]
>> Message posted via AccessMonster.com
>> http://www.accessmonster.com/Uwe/For...ccess/200611/1


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cascading Combo Boxes AFSSkier Microsoft Excel Programming 2 10th Sep 2009 08:18 PM
Cascading Combo Boxes (Multiple boxes) Adam Microsoft Access Forms 13 9th Jul 2008 07:47 PM
Cascading Combo Boxes--Problems Populating Boxes jerryb123 Microsoft Access 0 13th Jun 2008 03:11 PM
cascading combo boxes =?Utf-8?B?c3dvcmRzbWFuOA==?= Microsoft Access Forms 1 8th Mar 2007 06:07 PM
Cascading combo boxes for project Hustler24 Microsoft Excel New Users 9 18th Mar 2006 06:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:26 AM.