update combobox by other combobox

G

Guest

Got a query with 2 columns vesselname and ETA. The first combobox lists
all vesselname because row source = SELECT
VesselDate.DischargeVesselName FROM VesselDate GROUP BY
DischargeVesselName ORDER BY DischargeVesselName;

The afterupdate control to update the second combobox is:

Private Sub Combo0_AfterUpdate()

Dim sCombo2 As String

sCombo2 = "SELECT CSDischargeETA " & _
"FROM Vesseldate " & _
"WHERE DischargeVesselName = " &
Me.Combo0.Value
Me.Combo2.RowSource = sCombo2
Me.Combo2.Requery

End Sub

However this returns the following error:

Syntax error (missing operator) in query expression DischargeVesselName
= " & Me.Combo0.Value.


Someone any idea?
 
G

Guest

Please note that the DischargeVesselName generally speaking costs of 2
words i.e. "APL Discovery"


(e-mail address removed) schreef:
 
R

Regan via AccessMonster.com

Hi In your string

sCombo2 Put some more speech marks around the reference to Combo0

Example:
sCombo2 = "SELECT CSDischargeETA " & _
"FROM Vesseldate " & _
"WHERE DischargeVesselName = """ & Me.Combo0.Value & """"

Here it is spaced out

WHERE DischargeVesselName = " " " & Me.combo0.value & " " " "
So you can see better

Hope this helps


Got a query with 2 columns vesselname and ETA. The first combobox lists
all vesselname because row source = SELECT
VesselDate.DischargeVesselName FROM VesselDate GROUP BY
DischargeVesselName ORDER BY DischargeVesselName;

The afterupdate control to update the second combobox is:

Private Sub Combo0_AfterUpdate()

Dim sCombo2 As String

sCombo2 = "SELECT CSDischargeETA " & _
"FROM Vesseldate " & _
"WHERE DischargeVesselName = " &
Me.Combo0.Value
Me.Combo2.RowSource = sCombo2
Me.Combo2.Requery

End Sub
Syntax error (missing operator) in query expression DischargeVesselName
= " & Me.Combo0.Value.

Someone any idea?

In

--
Regan,
Paeroa
World famous in New Zealand

Message posted via AccessMonster.com
 

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