macro problem - not sure why error message box appears

Davros

Registered User.
Local time
Today, 23:01
Joined
Sep 9, 2005
Messages
131
hi guys

i've copied and altered the code below to populate a combo box with table names. all works fine except when i click a table name in the combo box to select it i get the message

microsoft access cannot find the macro "."



Private Sub Form_Load()
'ValueList variable will store a string that can
'be used as the Value List property for a combo box.
Dim ValueList As String
ValueList = ""
Dim op As String
op = Chr(34)

'Loop through all table names.
'For Each AccessObject In CurrentProject.AllTables
For Each tbl In CurrentData.AllTables
'code to exclude system tables which begin with "msys"
If Not Left(tbl.Name, 4) = "msys" Then
ValueList = ValueList + op + tbl.Name + op + ";"
End If
Next tbl

'Add current report name and semicolon to ValueList variable.


'Now make ValueList the Value List for the cbotables combo box.
Me!cbotables.RowSourceType = "Value List"
Me!cbotables.RowSource = ValueList
Me!cbotables.Requery

'Set the value of the ReportName control to the first item in the list.
Me!cbotables.Value = Me!cbotables.ItemData(0)

End Sub


i can't find anything wrong with the code above. can anyone see why i should get this message??

thanks in advance
 
I'm guessing it isn't the code but that in the properties window for the combo box in one of the events you have some text that Access thinks is the name of a macro. If this doesn't make sense let me know and I'll post a sample -
 
i've found a few possible solutions
1] change the file type association in the folder type options - does'nt work
2] remove the spaces from the event procedure name - does'nt work


i have no events typed into the combo box proprties. the code is tied to the on load event of the form itself

thanks anyway [perhaps a sample might be helpful?]
 
I'm confused as to why you think this code has an error. Instead of getting an error when you click the combo box you would (should) get and error when the form loads. ? (There may be an error in the code as I haven't read through it)
 
as far as i can see the code does what i want it to do.
when the form loads the combo box has a list of current table names within my database. this is what i want it to do. however when i click on one of the table names within the combo box i get the message

microsoft access cannot find the macro "."

i can then do nothing with this form except exit
 
Sorry, still looks like you have a single '.' where the macro would go in one of the combo box events.
 
i've checked everthing i can think off but i have no "." in the events tab

thanks anyway
 
i've cut the size and tables down but you can see how its supposed to work and i still get the same message which i click on a table name in the combo box

thanks for looking
 

Attachments

This one has me stumped but I'm not giving up...Hang on. :)
 
a. It's not the code.

...Still working, hang on.
 
b. It's not the form.

...Still working.
 
Well the fix is simple as far as I can tell - Simply put a new combo box on the form and use it. But I'd like to figure out why it zonks - :(
 
Ken,

What is interesting is

macro'.'

If you enter '.' as a macro (On say form open) you get macro''.' in the mesage.

I deleted the code and entered a number in the combo and the macro'.' msg came up when I closed the form.
 
ah - There is a space in the before update event - :)
 
thanks KenHigg
i deleted the combo box, re did it and it worked. the only thing i can think of is that orignally it was a text box that i converted to a combo box. i have now done it from the start as a combo box.

thanks for all your help
 
Who knows how the space got in there. You would think MS dev team would progam to trap something like that... :)
 

Users who are viewing this thread

Back
Top Bottom