Functions not working on different machine

Z

Zalthu

I have populated a list box from a query and have two buttons with code to
sort either by LastName or MembershipNumber. It works fine on my PC where I
developed it. A membership Number would typically be XX_001 or YYY_002 and I
want it to sort on the numerical value

Code which doesn't work: Me.lbMembers.RowSource = "SELECT [ID], [LastName],
[Firstname], [MembershipNo] FROM tblMembers ORDER BY
Right([MembershipNo],3);"

Code which runs OK: Me.lbMembers.RowSource = "SELECT [ID], [LastName],
[Firstname], [MembershipNo] FROM tblMembers ORDER BY [LastName];"

It won't work on my laptop. It just empties the ListBox and doesn't throw an
error. It restores the data when I run the 'SortByLastName' button I tried
to debug it on the laptop and tried to look at the help file but it said it
wasn't installed on this machine. This set me thinking. If I do the VBA on
my machine, will it not run on other machines where the user has installed
the basic, out of the box, Access.

I suspect it is not recognising the function 'Right'. I have exactly the
same references available on both machines.

Any ideas?
 
D

Douglas J. Steele

When you say "I have exactly the same references available on both
machines", does that mean you've gone into the References collection (Tools
| References when you're in the VB Editor) and none of the selected entries
have "MISSING:" in front of them?

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
 
Z

Zalthu

<< When you say "I have exactly the same references available on both
machines", does that mean you've gone into the References collection (Tools
| References when you're in the VB Editor) and none of the selected entries
have "MISSING:" in front of them?

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added.
If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)>>

Cracked it. Many thanks

Ian Millward
Edinburgh
 
Top