Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 3 Jun 2008 03:29:01 -0700,    group: microsoft.public.word.vba.beginners        back       


Initialising comboboxes during form-load   
I use the followin sub to initialise the rowsource of my comboboxes (from an 
Access-table) during form-load.

Naamlijst is the name of the list I want to use for a specific combobox.
Veldnaam is the fieldname of the combobox I want to initialise. 
FormNaam is the FormName on which the combobox is used.

The sub works fine for normal forms, however, comboboxes on subforms are not 
"found". How can I solve this?


Sub InitKeuzelijst(NaamLijst As String, veldnaam As String, FormNaam As 
String)

    'Init
    Dim Sqlq As String
    
    'Init keuzelijst
    Sqlq = "SELECT TblKLElement.Omschrijving, TblKLElement.ElementID FROM 
TblKeuzelijst "
    Sqlq = Sqlq & "INNER JOIN TblKLElement ON TblKeuzelijst.KeuzelijstID = 
TblKLElement.KeuzelijstID "
    Sqlq = Sqlq & "WHERE (((TblKeuzelijst.Omschrijving)= " & Chr(34) & 
NaamLijst & Chr(34) & "));"
    Forms(FormNaam).Controls(veldnaam).RowSource = Sqlq


End Sub
date: Tue, 3 Jun 2008 03:29:01 -0700   author:   Gert

Re: Initialising comboboxes during form-load   
Hi gert

This group deals with VBA in Word, not Access. The experts on Access will be 
over in one of the Access groups, and you will have a much better chance of 
getting an informed reply there.

-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

"Gert"  wrote in message 
news:8485C85B-7A1B-4B8B-B339-35BE94D4BE82@microsoft.com...
>I use the followin sub to initialise the rowsource of my comboboxes (from 
>an
> Access-table) during form-load.
>
> Naamlijst is the name of the list I want to use for a specific combobox.
> Veldnaam is the fieldname of the combobox I want to initialise.
> FormNaam is the FormName on which the combobox is used.
>
> The sub works fine for normal forms, however, comboboxes on subforms are 
> not
> "found". How can I solve this?
>
>
> Sub InitKeuzelijst(NaamLijst As String, veldnaam As String, FormNaam As
> String)
>
>    'Init
>    Dim Sqlq As String
>
>    'Init keuzelijst
>    Sqlq = "SELECT TblKLElement.Omschrijving, TblKLElement.ElementID FROM
> TblKeuzelijst "
>    Sqlq = Sqlq & "INNER JOIN TblKLElement ON TblKeuzelijst.KeuzelijstID =
> TblKLElement.KeuzelijstID "
>    Sqlq = Sqlq & "WHERE (((TblKeuzelijst.Omschrijving)= " & Chr(34) &
> NaamLijst & Chr(34) & "));"
>    Forms(FormNaam).Controls(veldnaam).RowSource = Sqlq
>
>
> End Sub
>
date: Tue, 3 Jun 2008 11:52:53 +0100   author:   Jonathan West

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us