Code does not run..no error

Petros

Registered User.
Local time
Today, 01:36
Joined
Jun 30, 2010
Messages
145
Hi all,

i pasted this code in a sub and expected an "error" or "debug" message..but nothing happenes..why?


Private Sub Alert_AfterUpdate()

On Error Resume Next
cboCity.RowSource = "Select tblAll.City " & _
"FROM tblAll " & _
"WHERE tblAll.Country = '" & cboCountry.Value & "' " & _
"ORDER BY tblAll.City;"

End Sub


Thanks!
 
Because you have told it to ignore errors

On Error Resume Next

take this line out and see what happens
 
TRy

On Error Resume Next
cboCity.RowSource = "Select tblAll.City " & _
"FROM tblAll " & _
"WHERE tblAll.Country = '" & cboCountry.Value & "' " & _
"ORDER BY tblAll.City;"
Code:
Me.CboCity.RowSoure = "Select City From TblAll Where Country ='" & me.cboCountry & "'"

What is CboCountry? a number or a character?
 
Because you have told it to ignore errors

On Error Resume Next

take this line out and see what happens

Thank you Drake..i did..but still no raction..i entered the "correct code"..

The controll "AlertType" should present a value list..

strange..the code editor feels cold like a dead fish..

Private Sub Alert_AfterUpdate()


AlertType.RowSource = "Select AlertTypeEx.AlertType " & _
"FROM AlertTypeEx " & _
"WHERE AlertTypeEx.Alert = '" & Alert.Value & "' " & _
"ORDER BY AlertTypeEx.AlertType"
End Sub
 
What type of control is Alert? You would need to move the cursor out of that control for the AfterUpdate event to fire.
 
I think the value of the cboCountry is not returning a Country value. You might need to refer to the second column of that combo box.

me.cboCountry.column(1)

I'm assuming your list of countries have unique ID's so instead of using the name, refer to the ID in which case you can then use the value property.
 
Are you saying that your Countries table doesn't have an ID? Well, it should.
 
Try sticking a message box in Private Sub Alert_AfterUpdate(), it may not be being called at all.
 
So..it was my own stupidity that made this happen...
1, Read the instructions. 2. Read the instructions. 3. Read the instructions...bellow is the solution..I learned a good lesson :-)

In the row source property of the combo box:
SELECT DISTINCT AlertTypeEx.Alert FROM AlertTypeEx ORDER BY AlertTypeEx.Alert;
In the “after update” event of the same combo box:
Private Sub Alert_AfterUpdate()
On Error Resume Next
Me!AlertType.RowSource = "Select AlertTypeEx.AlertType " & _
"FROM AlertTypeEx " & _
"WHERE AlertTypeEx.Alert = '" & Alert.Value & "' " & _
"ORDER BY AlertTypeEx.AlertType;"

End Sub
And now everything functions well.
Sorry for taking up your time..Thanks!
 

Users who are viewing this thread

Back
Top Bottom