AfterUpdate Error Message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Attempting to sort form using a combo box according to the instructions on
Microsoft Help File Article 208390
Downloaded Northwind Database and followed the instructions on Article 208390
After completing the instructions, and attempting to use the new combo box
to sort the Customers table, the following message appeared.

"The expression After Update you entered as the event property setting
produced the following error: Ambiguous name detected:
cboLookup_AfterUpdate."
*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may be an error evaluating the funtion, event, or macro

Article 208390 instructions say enter the following code in AfterUpdate
Property:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

My Combo Box RowSource Type = Field List
My Combo Box RowSource property = Customers Table
My Combo Box Name property = cboLookup

My code looks like this:
Private Sub cboLookup_AfterUpdate()
Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

End Sub

Any help would be appreciated... Thank you.
 
You appear to have 2 Sub cboLookup_AfterUpdate() statements and two End Sub.
Get rid of one of each.
 
Thank you Douglas, I actually had tried that but nothing seemed to work.
This time it worked. I was unsure whether they should both be there or not.
Now I'll try it in my "real" database. If I mess it up again, I'll be back!

Thanks again... really glad folks like you are out there.

Douglas J. Steele said:
You appear to have 2 Sub cboLookup_AfterUpdate() statements and two End Sub.
Get rid of one of each.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Robbin said:
Attempting to sort form using a combo box according to the instructions on
Microsoft Help File Article 208390
Downloaded Northwind Database and followed the instructions on Article
208390
After completing the instructions, and attempting to use the new combo box
to sort the Customers table, the following message appeared.

"The expression After Update you entered as the event property setting
produced the following error: Ambiguous name detected:
cboLookup_AfterUpdate."
*The expression may not result in the name of a macro, the name of
a
user-defined function, or [Event Procedure].
*There may be an error evaluating the funtion, event, or macro

Article 208390 instructions say enter the following code in AfterUpdate
Property:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

My Combo Box RowSource Type = Field List
My Combo Box RowSource property = Customers Table
My Combo Box Name property = cboLookup

My code looks like this:
Private Sub cboLookup_AfterUpdate()
Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

End Sub

Any help would be appreciated... Thank you.
 
Hello Again:
As I suspected, the code in my real database doesn't work. I believe it has
something to do with the fact that the query it's calling has spaces in its
name. I've tried single quotes, double quotes, underlines between the words,
and brackets. It doesn't like any of them. When I try to run it I get a
yellow highlight on that line in the debug.

Here is my new code:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Table of Recipes Query ORDER BY [" &
Me!cboLookup & "];"
End Sub

Thank you again...

Douglas J. Steele said:
You appear to have 2 Sub cboLookup_AfterUpdate() statements and two End Sub.
Get rid of one of each.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Robbin said:
Attempting to sort form using a combo box according to the instructions on
Microsoft Help File Article 208390
Downloaded Northwind Database and followed the instructions on Article
208390
After completing the instructions, and attempting to use the new combo box
to sort the Customers table, the following message appeared.

"The expression After Update you entered as the event property setting
produced the following error: Ambiguous name detected:
cboLookup_AfterUpdate."
*The expression may not result in the name of a macro, the name of
a
user-defined function, or [Event Procedure].
*There may be an error evaluating the funtion, event, or macro

Article 208390 instructions say enter the following code in AfterUpdate
Property:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

My Combo Box RowSource Type = Field List
My Combo Box RowSource property = Customers Table
My Combo Box Name property = cboLookup

My code looks like this:
Private Sub cboLookup_AfterUpdate()
Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

End Sub

Any help would be appreciated... Thank you.
 
if the name has imbedded spaces, simply enclose the name in square brackets
.... [Table of Recipies Query] ... or am I missing something else...?
Robbin said:
Hello Again:
As I suspected, the code in my real database doesn't work. I believe it has
something to do with the fact that the query it's calling has spaces in its
name. I've tried single quotes, double quotes, underlines between the words,
and brackets. It doesn't like any of them. When I try to run it I get a
yellow highlight on that line in the debug.

Here is my new code:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Table of Recipes Query ORDER BY [" &
Me!cboLookup & "];"
End Sub

Thank you again...

Douglas J. Steele said:
You appear to have 2 Sub cboLookup_AfterUpdate() statements and two End Sub.
Get rid of one of each.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Robbin said:
Attempting to sort form using a combo box according to the instructions on
Microsoft Help File Article 208390
Downloaded Northwind Database and followed the instructions on Article
208390
After completing the instructions, and attempting to use the new combo box
to sort the Customers table, the following message appeared.

"The expression After Update you entered as the event property setting
produced the following error: Ambiguous name detected:
cboLookup_AfterUpdate."
*The expression may not result in the name of a macro, the name of
a
user-defined function, or [Event Procedure].
*There may be an error evaluating the funtion, event, or macro

Article 208390 instructions say enter the following code in AfterUpdate
Property:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

My Combo Box RowSource Type = Field List
My Combo Box RowSource property = Customers Table
My Combo Box Name property = cboLookup

My code looks like this:
Private Sub cboLookup_AfterUpdate()
Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

End Sub

Any help would be appreciated... Thank you.
 
Thanks Bob, that worked perfectly. I must not be saving and closing out of
the code correctly because both times I had already tried the right thing and
it did not seem to work until after I went back to make the suggested
changes. Thanks for your knowledge and your patience with amatuer coders.
That goes for Mr. Steel as well.

Bob Howard said:
if the name has imbedded spaces, simply enclose the name in square brackets
.... [Table of Recipies Query] ... or am I missing something else...?
Robbin said:
Hello Again:
As I suspected, the code in my real database doesn't work. I believe it has
something to do with the fact that the query it's calling has spaces in its
name. I've tried single quotes, double quotes, underlines between the words,
and brackets. It doesn't like any of them. When I try to run it I get a
yellow highlight on that line in the debug.

Here is my new code:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Table of Recipes Query ORDER BY [" &
Me!cboLookup & "];"
End Sub

Thank you again...

Douglas J. Steele said:
You appear to have 2 Sub cboLookup_AfterUpdate() statements and two End Sub.
Get rid of one of each.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Attempting to sort form using a combo box according to the instructions on
Microsoft Help File Article 208390
Downloaded Northwind Database and followed the instructions on Article
208390
After completing the instructions, and attempting to use the new combo box
to sort the Customers table, the following message appeared.

"The expression After Update you entered as the event property setting
produced the following error: Ambiguous name detected:
cboLookup_AfterUpdate."
*The expression may not result in the name of a macro, the name of
a
user-defined function, or [Event Procedure].
*There may be an error evaluating the funtion, event, or macro

Article 208390 instructions say enter the following code in AfterUpdate
Property:

Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

My Combo Box RowSource Type = Field List
My Combo Box RowSource property = Customers Table
My Combo Box Name property = cboLookup

My code looks like this:
Private Sub cboLookup_AfterUpdate()
Sub cboLookup_AfterUpdate()
Me.RecordSource = "SELECT * FROM Customers ORDER BY [" & Me!cboLookup &
"];"
End Sub

End Sub

Any help would be appreciated... Thank you.
 
Back
Top