PC Review


Reply
Thread Tools Rate Thread

Combobox problem, please help this novice!

 
 
Pierre
Guest
Posts: n/a
 
      17th Dec 2007
Hi,

I hope there is someone who can help me solve a problem.

I have a database sheet in excel called "datadga"

I have a userform on which i have a multipage object with a lot of text
boxes and comboboxes.
The use chooses an item from a dropdownlist on the multipage object and all
data of this particular item is retreived form the database sheet.
This works fine with textboxes, even if de database sheet does not have an
entry for this specific textbox. It leaves the textbox empty.

However, when i try to fill a combobox with teh value from a cell in the
database, it only works if there is a value present in that particular cell.
Otherwise i get an error for that particular combobox.

My question: How can i get rid of the error and let the program continue.
The combobox thould the have no value.

I now have the following code;

when a button is clicked, alle fields on the multipage object are filled
with data from the data sheet in the following way;

txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
klantmatrix.Column + 75)
cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
klantmatrix.Column + 76)
etc..(over 120 fields)

This works fine for both textbox and combobox as long as the cells in
"klantmatrix" are all filled.
When a cell is empty, the combobox presents an error and the program stops.

Please help me so i can move on with the application.

Pierre


 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      17th Dec 2007
Hi Pierre

Check if the cell is empty before you assign a value to the combobox.

txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
klantmatrix.Column + 75)
If Not IsEmpty(Worksheets("datadga").Cells(klantmatrix.Row,
klantmatrix.Column + 76)) Then
cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
klantmatrix.Column + 76)
End If

Regards,

Per


"Pierre" <(E-Mail Removed)> skrev i en meddelelse
news:47663729$0$85778$(E-Mail Removed)...
> Hi,
>
> I hope there is someone who can help me solve a problem.
>
> I have a database sheet in excel called "datadga"
>
> I have a userform on which i have a multipage object with a lot of text
> boxes and comboboxes.
> The use chooses an item from a dropdownlist on the multipage object and
> all data of this particular item is retreived form the database sheet.
> This works fine with textboxes, even if de database sheet does not have an
> entry for this specific textbox. It leaves the textbox empty.
>
> However, when i try to fill a combobox with teh value from a cell in the
> database, it only works if there is a value present in that particular
> cell.
> Otherwise i get an error for that particular combobox.
>
> My question: How can i get rid of the error and let the program continue.
> The combobox thould the have no value.
>
> I now have the following code;
>
> when a button is clicked, alle fields on the multipage object are filled
> with data from the data sheet in the following way;
>
> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> klantmatrix.Column + 75)
> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> klantmatrix.Column + 76)
> etc..(over 120 fields)
>
> This works fine for both textbox and combobox as long as the cells in
> "klantmatrix" are all filled.
> When a cell is empty, the combobox presents an error and the program
> stops.
>
> Please help me so i can move on with the application.
>
> Pierre
>
>



 
Reply With Quote
 
Pierre
Guest
Posts: n/a
 
      17th Dec 2007
Hi Per,

Thank you again, this works fine als but..

if the cell is not empty but has a value that is not in the combobox, it
should also not be a problem and it still is if i use your method.
Any suggestions on that ?
Thanks,
Pierre

"Per Jessen" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Hi Pierre
>
> Check if the cell is empty before you assign a value to the combobox.
>
> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> klantmatrix.Column + 75)
> If Not IsEmpty(Worksheets("datadga").Cells(klantmatrix.Row,
> klantmatrix.Column + 76)) Then
> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> klantmatrix.Column + 76)
> End If
>
> Regards,
>
> Per
>
>
> "Pierre" <(E-Mail Removed)> skrev i en meddelelse
> news:47663729$0$85778$(E-Mail Removed)...
>> Hi,
>>
>> I hope there is someone who can help me solve a problem.
>>
>> I have a database sheet in excel called "datadga"
>>
>> I have a userform on which i have a multipage object with a lot of text
>> boxes and comboboxes.
>> The use chooses an item from a dropdownlist on the multipage object and
>> all data of this particular item is retreived form the database sheet.
>> This works fine with textboxes, even if de database sheet does not have
>> an entry for this specific textbox. It leaves the textbox empty.
>>
>> However, when i try to fill a combobox with teh value from a cell in the
>> database, it only works if there is a value present in that particular
>> cell.
>> Otherwise i get an error for that particular combobox.
>>
>> My question: How can i get rid of the error and let the program continue.
>> The combobox thould the have no value.
>>
>> I now have the following code;
>>
>> when a button is clicked, alle fields on the multipage object are filled
>> with data from the data sheet in the following way;
>>
>> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>> klantmatrix.Column + 75)
>> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>> klantmatrix.Column + 76)
>> etc..(over 120 fields)
>>
>> This works fine for both textbox and combobox as long as the cells in
>> "klantmatrix" are all filled.
>> When a cell is empty, the combobox presents an error and the program
>> stops.
>>
>> Please help me so i can move on with the application.
>>
>> Pierre
>>
>>

>
>



 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      17th Dec 2007
Hi Pierre

Thanks for your reply.

I am not sure what your problem are.


Regards,
Per

"Pierre" <(E-Mail Removed)> skrev i en meddelelse
news:47666600$0$85792$(E-Mail Removed)...
> Hi Per,
>
> Thank you again, this works fine als but..
>
> if the cell is not empty but has a value that is not in the combobox, it
> should also not be a problem and it still is if i use your method.
> Any suggestions on that ?
> Thanks,
> Pierre
>
> "Per Jessen" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed)...
>> Hi Pierre
>>
>> Check if the cell is empty before you assign a value to the combobox.
>>
>> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>> klantmatrix.Column + 75)
>> If Not IsEmpty(Worksheets("datadga").Cells(klantmatrix.Row,
>> klantmatrix.Column + 76)) Then
>> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>> klantmatrix.Column + 76)
>> End If
>>
>> Regards,
>>
>> Per
>>
>>
>> "Pierre" <(E-Mail Removed)> skrev i en meddelelse
>> news:47663729$0$85778$(E-Mail Removed)...
>>> Hi,
>>>
>>> I hope there is someone who can help me solve a problem.
>>>
>>> I have a database sheet in excel called "datadga"
>>>
>>> I have a userform on which i have a multipage object with a lot of text
>>> boxes and comboboxes.
>>> The use chooses an item from a dropdownlist on the multipage object and
>>> all data of this particular item is retreived form the database sheet.
>>> This works fine with textboxes, even if de database sheet does not have
>>> an entry for this specific textbox. It leaves the textbox empty.
>>>
>>> However, when i try to fill a combobox with teh value from a cell in the
>>> database, it only works if there is a value present in that particular
>>> cell.
>>> Otherwise i get an error for that particular combobox.
>>>
>>> My question: How can i get rid of the error and let the program
>>> continue. The combobox thould the have no value.
>>>
>>> I now have the following code;
>>>
>>> when a button is clicked, alle fields on the multipage object are filled
>>> with data from the data sheet in the following way;
>>>
>>> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>>> klantmatrix.Column + 75)
>>> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>>> klantmatrix.Column + 76)
>>> etc..(over 120 fields)
>>>
>>> This works fine for both textbox and combobox as long as the cells in
>>> "klantmatrix" are all filled.
>>> When a cell is empty, the combobox presents an error and the program
>>> stops.
>>>
>>> Please help me so i can move on with the application.
>>>
>>> Pierre
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Pierre
Guest
Posts: n/a
 
      17th Dec 2007
Hi Per,

What i mean is the following;

the combobox is filled in vba (not from the datadga sheet).
In the datadga sheet there are cells that are not empty and not have a value
that is also in the combobox.
If i then use your code, i still get an error message because the cell
contents does not match any item in the combobox.

Any ideas?
Thanks,
Pierre

"Per Jessen" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Hi Pierre
>
> Thanks for your reply.
>
> I am not sure what your problem are.
>
>
> Regards,
> Per
>
> "Pierre" <(E-Mail Removed)> skrev i en meddelelse
> news:47666600$0$85792$(E-Mail Removed)...
>> Hi Per,
>>
>> Thank you again, this works fine als but..
>>
>> if the cell is not empty but has a value that is not in the combobox, it
>> should also not be a problem and it still is if i use your method.
>> Any suggestions on that ?
>> Thanks,
>> Pierre
>>
>> "Per Jessen" <(E-Mail Removed)> schreef in bericht
>> news:(E-Mail Removed)...
>>> Hi Pierre
>>>
>>> Check if the cell is empty before you assign a value to the combobox.
>>>
>>> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>>> klantmatrix.Column + 75)
>>> If Not IsEmpty(Worksheets("datadga").Cells(klantmatrix.Row,
>>> klantmatrix.Column + 76)) Then
>>> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>>> klantmatrix.Column + 76)
>>> End If
>>>
>>> Regards,
>>>
>>> Per
>>>
>>>
>>> "Pierre" <(E-Mail Removed)> skrev i en meddelelse
>>> news:47663729$0$85778$(E-Mail Removed)...
>>>> Hi,
>>>>
>>>> I hope there is someone who can help me solve a problem.
>>>>
>>>> I have a database sheet in excel called "datadga"
>>>>
>>>> I have a userform on which i have a multipage object with a lot of text
>>>> boxes and comboboxes.
>>>> The use chooses an item from a dropdownlist on the multipage object and
>>>> all data of this particular item is retreived form the database sheet.
>>>> This works fine with textboxes, even if de database sheet does not have
>>>> an entry for this specific textbox. It leaves the textbox empty.
>>>>
>>>> However, when i try to fill a combobox with teh value from a cell in
>>>> the database, it only works if there is a value present in that
>>>> particular cell.
>>>> Otherwise i get an error for that particular combobox.
>>>>
>>>> My question: How can i get rid of the error and let the program
>>>> continue. The combobox thould the have no value.
>>>>
>>>> I now have the following code;
>>>>
>>>> when a button is clicked, alle fields on the multipage object are
>>>> filled with data from the data sheet in the following way;
>>>>
>>>> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>>>> klantmatrix.Column + 75)
>>>> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
>>>> klantmatrix.Column + 76)
>>>> etc..(over 120 fields)
>>>>
>>>> This works fine for both textbox and combobox as long as the cells in
>>>> "klantmatrix" are all filled.
>>>> When a cell is empty, the combobox presents an error and the program
>>>> stops.
>>>>
>>>> Please help me so i can move on with the application.
>>>>
>>>> Pierre
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      18th Dec 2007
On 17 Dec., 21:35, "Pierre" <j.da...@wanadoo.nl> wrote:
> Hi Per,
>
> What i mean is the following;
>
> the combobox is filled in vba (not from the datadga sheet).
> In the datadga sheet there are cells that are not empty and not have a value
> that is also in the combobox.
> If i then use your code, i still get an error message because the cell
> contents does not match any item in the combobox.
>
> Any ideas?
> Thanks,
> Pierre
>
> "Per Jessen" <per.jes...@mail.dk> schreef in berichtnews:(E-Mail Removed)...
>
>
>
> > Hi Pierre

>
> > Thanks for your reply.

>
> > I am not sure what your problem are.

>
> > Regards,
> > Per

>
> > "Pierre" <j.da...@wanadoo.nl> skrev i en meddelelse
> >news:47666600$0$85792$(E-Mail Removed)...
> >> Hi Per,

>
> >> Thank you again, this works fine als but..

>
> >> if the cell is not empty but has a value that is not in the combobox, it
> >> should also not be a problem and it still is if i use your method.
> >> Any suggestions on that ?
> >> Thanks,
> >> Pierre

>
> >> "Per Jessen" <per.jes...@mail.dk> schreef in bericht
> >>news:(E-Mail Removed)...
> >>> Hi Pierre

>
> >>> Check if the cell is empty before you assign a value to the combobox.

>
> >>> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> >>> klantmatrix.Column + 75)
> >>> If Not IsEmpty(Worksheets("datadga").Cells(klantmatrix.Row,
> >>> klantmatrix.Column + 76)) Then
> >>> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> >>> klantmatrix.Column + 76)
> >>> End If

>
> >>> Regards,

>
> >>> Per

>
> >>> "Pierre" <j.da...@wanadoo.nl> skrev i en meddelelse
> >>>news:47663729$0$85778$(E-Mail Removed)...
> >>>> Hi,

>
> >>>> I hope there is someone who can help me solve a problem.

>
> >>>> I have a database sheet in excel called "datadga"

>
> >>>> I have a userform on which i have a multipage object with a lot of text
> >>>> boxes and comboboxes.
> >>>> The use chooses an item from a dropdownlist on the multipage object and
> >>>> all data of this particular item is retreived form the database sheet..
> >>>> This works fine with textboxes, even if de database sheet does not have
> >>>> an entry for this specific textbox. It leaves the textbox empty.

>
> >>>> However, when i try to fill a combobox with teh value from a cell in
> >>>> the database, it only works if there is a value present in that
> >>>> particular cell.
> >>>> Otherwise i get an error for that particular combobox.

>
> >>>> My question: How can i get rid of the error and let the program
> >>>> continue. The combobox thould the have no value.

>
> >>>> I now have the following code;

>
> >>>> when a button is clicked, alle fields on the multipage object are
> >>>> filled with data from the data sheet in the following way;

>
> >>>> txt_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> >>>> klantmatrix.Column + 75)
> >>>> cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
> >>>> klantmatrix.Column + 76)
> >>>> etc..(over 120 fields)

>
> >>>> This works fine for both textbox and combobox as long as the cells in
> >>>> "klantmatrix" are all filled.
> >>>> When a cell is empty, the combobox presents an error and the program
> >>>> stops.

>
> >>>> Please help me so i can move on with the application.

>
> >>>> Pierre- Skjul tekst i anførselstegn -

>
> - Vis tekst i anførselstegn -


Hi Pierre

I have solved your problem:-)

Syntax:
Combobox1=Range("A1").Value

Your line will be:
cbo_opnpnapd1 = Worksheets("datadga").Cells(klantmatrix.Row,
klantmatrix.Column + 76) .Value

Regands,
Per
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Problem: Combobox.setfocus fires combobox.OnClick event Hal Levy Microsoft Access Form Coding 5 31st Jul 2009 03:54 AM
Novice with a network problem John O'Boyle Windows XP Networking 3 22nd Oct 2006 04:24 PM
Help a Novice - Log in Problem Lorraine Young Windows XP Help 1 21st Oct 2004 03:39 PM
Help a Novice - Log In Problem Lorraine Young Windows XP Help 1 21st Oct 2004 03:37 PM
Novice with virus problem =?Utf-8?B?RG9kZ2VjaXR5MTA=?= Windows XP Help 3 21st Feb 2004 05:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:48 AM.