By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,955 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,955 IT Pros & Developers. It's quick & easy.

Macro substitution request

P: n/a
I am using WinXP and Access 2003.

On a form I have eight lists. A public variable, called cLastList,
remembers which list was the last one selected. When I come to a new
list I would like to unselect the row in the last list and update the
variable cLastList.

Something like this:

Private Sub lstconstructiontype_GotFocus()
me.(cLastList).value = null
cLastList = (name of this object)
End Sub

This does not work.

I could use a select case to find which list to set to null,

Select Case cLastList
Case "lstconstructiontype"
me.lstconstructiontype.value = null
cLastList = "lstconstructiontype"
....
End Select

but I am looking for a shorter way as outlined above.

Any help is greatly appreciated.

Regards,

Jan Nordgreen

think again!
http://simpler-solutions.net/pmachin...thinkagain.php

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
>
Private Sub lstconstructiontype_GotFocus()
me.(cLastList).value = null
cLastList = (name of this object)
End Sub


Does your first line even compile?
Perhaps something more like

Me(cLastList).Value = Null
cLastList = Screen.ActiveControl.Name

So that you can put it in a procedure that is called identically from all of
your lists?
(Bearing in mind that it may need an initial value - or just error handling
to allow for that.)
Nov 13 '05 #2

P: n/a
My first line was just an idea. :)

Your lines compiled beautifully! making my program faster to write and
much more maintainable!

As you said, I can now put these two instructions in a procedure.

Thanks!

Regards,

Jan Nordgreen

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.