From: Duncs on
I have a form with two unbound combo boxes, and several fields.

The idea of the form is that the user can select either of the two
combo's and the rest of the fields on the form will populate.

So, for example, if the user selects an entry from cboContractAccount,
the table will be searched and the fields populated with the values
associated with that ContractAccount. Alternatively, the user can
select an entry from cboSerialNum--if they don't know the
ContractAccount--and the fields will populate as appropriate.

However what I want to do is, if they select a ContractAccount from
cboContractAccount, I want cboSerialNum to populate with the serial
number for that record, and vice-versa. I've tried using:

.cboContractAccount.Value = ContractAcct

Where ContractAccount is the value retrieved from the database. In
debug mode, ContractAcct shows ''85002312542'
and .cboContractAccount.Value shows ''85002312542'. But, on the form,
cboContractAccount is blank.

Anyone advise?

TIA

Duncs
From: Arvin Meyer [MVP] on
Use the column property of the combo. Say the serial number is in the 4th
column:

Me.cboContractAccount.Column(3)

The column index is zero based.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Duncs" <true.kilted.scot(a)gmail.com> wrote in message
news:1c406a13-e040-4988-b768-0efc3229f8fb(a)v20g2000yqv.googlegroups.com...
>I have a form with two unbound combo boxes, and several fields.
>
> The idea of the form is that the user can select either of the two
> combo's and the rest of the fields on the form will populate.
>
> So, for example, if the user selects an entry from cboContractAccount,
> the table will be searched and the fields populated with the values
> associated with that ContractAccount. Alternatively, the user can
> select an entry from cboSerialNum--if they don't know the
> ContractAccount--and the fields will populate as appropriate.
>
> However what I want to do is, if they select a ContractAccount from
> cboContractAccount, I want cboSerialNum to populate with the serial
> number for that record, and vice-versa. I've tried using:
>
> .cboContractAccount.Value = ContractAcct
>
> Where ContractAccount is the value retrieved from the database. In
> debug mode, ContractAcct shows ''85002312542'
> and .cboContractAccount.Value shows ''85002312542'. But, on the form,
> cboContractAccount is blank.
>
> Anyone advise?
>
> TIA
>
> Duncs


From: david.tickle8 on
davidtickle

"Duncs" <true.kilted.scot(a)gmail.com> wrote in message
news:1c406a13-e040-4988-b768-0efc3229f8fb(a)v20g2000yqv.googlegroups.com...
> I have a form with two unbound combo boxes, and several fields.
>
> The idea of the form is that the user can select either of the two
> combo's and the rest of the fields on the form will populate.
>
> So, for example, if the user selects an entry from cboContractAccount,
> the table will be searched and the fields populated with the values
> associated with that ContractAccount. Alternatively, the user can
> select an entry from cboSerialNum--if they don't know the
> ContractAccount--and the fields will populate as appropriate.
>
> However what I want to do is, if they select a ContractAccount from
> cboContractAccount, I want cboSerialNum to populate with the serial
> number for that record, and vice-versa. I've tried using:
>
> .cboContractAccount.Value = ContractAcct
>
> Where ContractAccount is the value retrieved from the database. In
> debug mode, ContractAcct shows ''85002312542'
> and .cboContractAccount.Value shows ''85002312542'. But, on the form,
> cboContractAccount is blank.
>
> Anyone advise?
>
> TIA
>
> Duncs
From: Duncs on
Arvin,

Thanks for your suggestion. I've now changed the code as follows:

With Form
.cboContractAccount.Column(1) = ContractAcct
.cboSerial.Column(1) = SerialNum

But, when I run this, I am getting an error on the first assignment as
follows:

Err.number - 424
Err.Description - Object required

The code is in a 'DisplayRecord' routine that populates a form of
unbouond fields with the results of a query..

If I select an account number from the combo, when it enters the
routine, Form.cboContractAccount.Column(1) = 850034630569, which is
the value selected in the dropdown. The ContractAcct value passed is
850034630569. So, normal code execution is:

Select value
Retrieve data
Display data

However, with the two combos, I can't get them to show / retain the
value passed.

Help!!

Duncs


On 23 Feb, 12:54, "Arvin Meyer [MVP]" <arv...(a)mvps.invalid> wrote:
> Use the column property of the combo. Say the serial number is in the 4th
> column:
>
> Me.cboContractAccount.Column(3)
>
> The column index is zero based.
> --
> Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com
>
> "Duncs" <true.kilted.s...(a)gmail.com> wrote in message
>
> news:1c406a13-e040-4988-b768-0efc3229f8fb(a)v20g2000yqv.googlegroups.com...
>
>
>
> >I have a form with two unbound combo boxes, and several fields.
>
> > The idea of the form is that the user can select either of the two
> > combo's and the rest of the fields on the form will populate.
>
> > So, for example, if the user selects an entry from cboContractAccount,
> > the table will be searched and the fields populated with the values
> > associated with that ContractAccount.  Alternatively, the user can
> > select an entry from cboSerialNum--if they don't know the
> > ContractAccount--and the fields will populate as appropriate.
>
> > However what I want to do is, if they select a ContractAccount from
> > cboContractAccount, I want cboSerialNum to populate with the serial
> > number for that record, and vice-versa.  I've tried using:
>
> >        .cboContractAccount.Value = ContractAcct
>
> > Where ContractAccount is the value retrieved from the database.  In
> > debug mode, ContractAcct shows ''85002312542'
> > and .cboContractAccount.Value shows ''85002312542'.  But, on the form,
> > cboContractAccount is blank.
>
> > Anyone advise?
>
> > TIA
>
> > Duncs- Hide quoted text -
>
> - Show quoted text -

From: Duncs on
I've tried.Column(1), I've tried .Text, I've tried everything I can
think of, but nothing seems to work.

I can't get a value assigned to the either of these combo controls.

Can someone help?

Many TIA

Duncs


On 25 Feb, 10:53, Duncs <true.kilted.s...(a)gmail.com> wrote:
> Arvin,
>
> Thanks for your suggestion.  I've now changed the code as follows:
>
>     With Form
>         .cboContractAccount.Column(1) = ContractAcct
>         .cboSerial.Column(1) = SerialNum
>
> But, when I run this, I am getting an error on the first assignment as
> follows:
>
> Err.number - 424
> Err.Description - Object required
>
> The code is in a 'DisplayRecord' routine that populates a form of
> unbouond fields with the results of a query..
>
> If I select an account number from the combo, when it enters the
> routine, Form.cboContractAccount.Column(1) = 850034630569, which is
> the value selected in the dropdown.  The ContractAcct value passed is
> 850034630569.  So, normal code execution is:
>
> Select value
> Retrieve data
> Display data
>
> However, with the two combos, I can't get them to show / retain the
> value passed.
>
> Help!!
>
> Duncs
>
> On 23 Feb, 12:54, "Arvin Meyer [MVP]" <arv...(a)mvps.invalid> wrote:
>
>
>
> > Use the column property of the combo. Say the serial number is in the 4th
> > column:
>
> > Me.cboContractAccount.Column(3)
>
> > The column index is zero based.
> > --
> > Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmv...
>
> > "Duncs" <true.kilted.s...(a)gmail.com> wrote in message
>
> >news:1c406a13-e040-4988-b768-0efc3229f8fb(a)v20g2000yqv.googlegroups.com....
>
> > >I have a form with two unbound combo boxes, and several fields.
>
> > > The idea of the form is that the user can select either of the two
> > > combo's and the rest of the fields on the form will populate.
>
> > > So, for example, if the user selects an entry from cboContractAccount,
> > > the table will be searched and the fields populated with the values
> > > associated with that ContractAccount.  Alternatively, the user can
> > > select an entry from cboSerialNum--if they don't know the
> > > ContractAccount--and the fields will populate as appropriate.
>
> > > However what I want to do is, if they select a ContractAccount from
> > > cboContractAccount, I want cboSerialNum to populate with the serial
> > > number for that record, and vice-versa.  I've tried using:
>
> > >        .cboContractAccount.Value = ContractAcct
>
> > > Where ContractAccount is the value retrieved from the database.  In
> > > debug mode, ContractAcct shows ''85002312542'
> > > and .cboContractAccount.Value shows ''85002312542'.  But, on the form,
> > > cboContractAccount is blank.
>
> > > Anyone advise?
>
> > > TIA
>
> > > Duncs- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -