Re: Initialising comboboxes during form-load

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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" <Gert@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8485C85B-7A1B-4B8B-B339-35BE94D4BE82@xxxxxxxxxxxxxxxx
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



.



Relevant Pages

  • RE: Need help with a Custom Function
    ... Public Sub FillTextBoxes(cmb As ComboBox, frmName As String, myStr As String) ...
    (microsoft.public.access.formscoding)
  • Designer shows combobox but run time does not
    ... I tried to use a datasource with a combobox and it didn't work completely so ... Protected Overrides Sub Dispose ... Public Sub New(ByVal str As String, ... Public Property ToStringDisplaysSingle() As Boolean ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Arraylist question
    ... ToString virtual method in your PERSON class to return: ... public override string ToString() ... Now you can add the instances of person directly to the combobox which will ... > public int CompareTo ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Designer shows combobox but run time does not
    ... Sorry don't have access to VS but it seems that you are adding the entries after you bind the list to the combobox. ... Protected Overrides Sub Dispose ... Public Sub New(ByVal str As String, ... Public Property ToStringDisplaysSingle() As Boolean ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Macro jumps to combobox
    ... In the properties box for the combobox, ... Dim sAccessFile As String ... Dim filterrng As String ...
    (microsoft.public.excel.programming)