Adding database data to a combo box...

Hi guys,


I have a working databse query thar returns a list of names.  I want to

put this into a combo box.  Currently I am inserting the database data
into a range on my spreadsheet (A1) and it uses as many rows as there
are names.  In my combo box properties I can specify the ListFillRange
as A1:A5 or whatever and this works okay, but the thing is, as names
are added to the database, I want the range A1:A5 to update
dynamically.


Q1.  Can I send the QueryTable data directly to the combo box
ListFillRange...


With ActiveSheet.QueryTables.Add(Co=ADnnection:=3Dconnstring,
Destination:=3DComboBox1.ListFil=ADlRange etc.


Q2.  If I can't do that, is there an Excel function that can tell me
the position of the last record in the range... A10 or A30 or whatever,

so I can use VB code to reset the range after the query returns...


       .Refresh
End With


ComboBox1.ListFillRange("A1:" & something here...


Thanks guys.=20


Cheers,=20
Lyndon.

0
7/27/2005 6:15:21 AM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
360 Views

Similar Articles

[PageSpeed] 8

Create an Excel name (Insert>Name>Define) with a name of say myData and a
Refersto value of

=OFFSET($A$1,,,COUNTA($A:$A))

and use =myData in the combobox ListFillRange

-- 
 HTH

Bob Phillips

"Lyndon" <lyndon.webster@gmail.com> wrote in message
news:1122444921.407462.186260@g47g2000cwa.googlegroups.com...
Hi guys,


I have a working databse query thar returns a list of names.  I want to

put this into a combo box.  Currently I am inserting the database data
into a range on my spreadsheet (A1) and it uses as many rows as there
are names.  In my combo box properties I can specify the ListFillRange
as A1:A5 or whatever and this works okay, but the thing is, as names
are added to the database, I want the range A1:A5 to update
dynamically.


Q1.  Can I send the QueryTable data directly to the combo box
ListFillRange...


With ActiveSheet.QueryTables.Add(Co�nnection:=connstring,
Destination:=ComboBox1.ListFil�lRange etc.


Q2.  If I can't do that, is there an Excel function that can tell me
the position of the last record in the range... A10 or A30 or whatever,

so I can use VB code to reset the range after the query returns...


       .Refresh
End With


ComboBox1.ListFillRange("A1:" & something here...


Thanks guys.


Cheers,
Lyndon.


0
phillips1 (803)
7/27/2005 9:42:55 AM
Reply:

Similar Artilces:

Adding hyperlinks with parameters
Hey everybody I have a batch file which needs to be run from an excel sheet with a parameter, like this: c:\1.bat myParameter But when i try to run the Hyperlink, the Excel shows an error message saying it can't open the specified file (probably because the is a space between the file and the parameter) is there any known way to run the link from the excel? On Mar 2, 12:45=A0pm, Pasha <pavel_v...@mailto.mod.gov.il> wrote: > Hey everybody > I have a batch file which needs to be run from an excel sheet with a > parameter, like this: > c:\1.bat myParameter > But when i ...

Adding Blank Rows after the last Detail of the Report
Hi All, I've used this code from Dwayne: Private Sub Report_Page() Dim intNumLines As Integer Dim intLineNumber As Integer Dim intTopMargin As Integer Dim ctl As Control Dim intLineHeight As Integer intNumLines = 12 intTopMargin = Me.Section(3).Height intLineHeight = Me.Section(0).Height For Each ctl In Me.Section(0).Controls For intLineNumber = 0 To intNumLines - 1 Me.Line (ctl.Left, intTopMargin + _ (intLineNumber * intLineHeight)) - _ Step(ctl.Width, intLineHeight), , B Next Next End Sub My report needs to print blank rows (at least...

Recipe Database in Access
Hi Guys Last year my partner and I bought a small country kitchen where we make jams, chutneys, sauces etc. We would like to put all our recipes into an access database. Can anyone please point us in the right direction to find one. The functionality we are looking for includes: - ingredient searches ... eg - so we can pull up all recipes that malt vinegar (which includes gluten) and replace with a gluten free vinegar. - ingredient costs ... to help with product pricing. - volume output - recipe owner ... some of the recipes are owned by a specific customers and we only make that produ...

outlook vcard, ad integration user properties
my boss is trying to get hix fax# in his vcard. he is using his address from the global address list I have modified his profile in active directory users and computers: I go into AD users and computers, double click on his user, go to the telephones tab, and enter his fax #. but when I did this his fax # is still not being pulled up in his outlook vcard. Does anyone know where outlook is trying to get this field from / how i can get this field into his vcard? thx ...

Cut not Copy Appended Data
In this great Macro, created by Micky (MVP), is there a way to cut and paste the data from all the columns instead of copy and paste? I just want all the appended data in Column A". Sub Tony() Application.ScreenUpdating = False LR = ActiveSheet.UsedRange.Rows.Count LC = ActiveSheet.UsedRange.Columns.Count Ind = LR + 1 For C = 2 To LC For R = 1 To LR If Cells(R, C) <> "" Then Cells(Ind, 1) = Cells(R, C) Ind = Ind + 1 End If Next Next Application.ScreenUpdati...

Formatting Cells/Data
Hi, I hope you are doing well. I have a file I downloaded from our AS/400 (OS400 operating system). I open the file as a text file and go thru the wizard for converting the file to excel format. One of the columns/fields is numeric with some neg and pos numbers and some blank cell contents. During the wizard conversion the field is categorized as DOUBLE with no option to change the field. When I finish the wizard I save the file as an Excel workbook. Then I use the autosum option to calculate the total of the field/column; however, it only picks up on the positive #'s. Hence the t...

pop-up form/message box problem
I have a main form where records are entered; in one field users select from a list of citations, if they type something that's not on the list, a message box pops up asking if they'd like to add the new citation, when they click "yes" the pop-up form where they enter the citation information opens, no problem. HOWEVER, if they close the pop-up form without entering any data the default Access message " The text you entered isn't an item in the list." appears. How do I prevent that from happening? -- Message posted via AccessMonster.com http://www.accessmon...

ADDING A NUMBER
how do i add a number to a range of cells? I need to add 11.27 to a number of different cells each with a different number in them Put 11.27 in an empty cell, format it the same way as the numbers you want to add to, copy it, then select the numbers you want to add to and do edit>paste special and select add. -- Regards, Peo Sjoblom "Helpme" <Helpme@discussions.microsoft.com> wrote in message news:6D51344A-78E6-4377-B292-FC6C16FF6BA2@microsoft.com... > how do i add a number to a range of cells? I need to add 11.27 to a > number > of different cells e...

Microsoft Sync Services/Microsoft Database Utility
Version: 2004 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I've been getting this error repeatedly while working on my Mac, &quot;Microsoft Sync Services has encountered a problem and needs to close. We are sorry for the inconvenience&quot;. <br> When I open the Microsoft Database Utility to run, it does fine for a few minutes, then I get the message, &quot;Some Office programs could not be closed automatically . Quit all Office programs, and then click OK&quot;, followed by &quot;Do you want to quit Microsoft Messenger and all Microsoft Offi...

database offline defragmentation
hey folks it looks like we need to defrag our database (it's about 26gb) problem is we only have ~17gb space left on the partition (can't install any more drives, and the other partition is smaller) now question here is this : will 16GB be enough for the defrag ? if not .. any advice ? aside from killing the one who bought such a small hd.. Stas_K wrote: > hey folks > > it looks like we need to defrag our database (it's about 26gb) What makes you think so? -- If my message is helpful, please help me by registering at http://www.openoffice.org/servlets/Join and v...

Requery of combo box
I have a form (input) with 5 combo boxes (registration, location, notes, time & date) and 4 Yes / no check boxes. It writes to a table (Data file) The combo boxes do update with the after event function but as soon as I type into any of the combo boxes a new blank row is added to the form which is set as dataenty "yes" The problem is that the updated combo box content list is always 1 row behind where the data is being entered. Is there a way of changing when the new row is added to the form please? thanks richard ...

Using Concatenate function to generate text in Text Box
I would like to have a text box on my chart, whose text is generated by concatenating the values from two different cells (B4 and B6) on a specific worksheet in my Excel file. I was able to use a reference to cell B4 to generate the text for my text box using the following formula: ='SSTyp-AllD'!$H$4 However, when I try to enter either of the following formulas for the text box text: =concatenate('SSTyp-AllD'!$H$4, 'SSTyp-AllD'!$H$6) ='SSTyp-AllD'!$H$4 & 'SSTyp-AllD'!$H$6 I get the error message "The text you entered is not a valid refe...

adding new records
I am totally new to CRM, so I hope this is really easy question: This concerns permissions.. I have a "sales" group, and with one of those people i need to be able to let them add new records on behalf of other "sales" people. Is there like a standard permission setting for it? (obviously every "sales" person can add new records if they select them selfs as the owner) thanks, Michal. Hi, By default the person who creates the record will be the owner. After record creation the person could reassign the record (manually) to another user. If all rec...

Save as Msg box
I have the follwowing to save as a form: Sub SaveAs() ' ChDir "V:\Netshare\Item Master Creation\2005 Item Request Submission" Do fName = Application.GetSaveAsFilename Loop Until fName <> False ActiveWorkbook.SaveAs Filename:=fName, FileFormat:=xlNormal End Sub Problems: 1. It doesn't go to the directory that I have above: "V:\Netshare\Item Master Creation\2005 Item Request Submission" 2. I want to enter a message box that confirms that yes they want to save after they have entered the name in the save as box. In the Excel hlp I was just ...

When adding attachments...
....in Outlook the following errors comes up: "Out of memory or system resources, please close some programs and try again" Quotas are fine. I have deinstalled/reinstalled Office, cleaned 'temp' areas, and many other tidbits. Any other ideas? Thanks. This might help as i had this problem with Outlook 98. Is the file you are trying to copy to attach nested in sub folders? if so try and copy the attachment to a root drive like c:\ Ignore previous email. wrong spellin if the attachment is nested in sub folders(this means you have to open different folders to get to ...

write macro to input data
I am new at Excel. I want to write a small macro, four or five columns where I can go to column 1 and input data, then go to column 2 and input date, etc., then when I get to the end of the fifth column have it return and go to add more data in column 1. Any help will be appreciated from the experts in Excel. Thanks. one way to do this is to use a worksheet_change event right click sheet tab>view code>copy/paste this>modify to suit>SAVE Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If Target.Row > 5 And Target.Column = 8 Then ActiveCell.Offset(1, ...

Picture Disappears When Added To Contact In Outlook 2003
Can someone help please. When I try to attach a picture to a contact in outlook 2003 immediately I double click the picture to be attached it disappears out of the outlook contact along with the placement holder in the form. Only when I right click the mouse and go remove picture do I get the placement holder back. I have looked at all the help menus but they offer no clues. Thanks TS ...

How do I exclude data using the IIF statement in report builder
I have data in my dataset that I want to exclude in the average calculation for the final report (those with a key.value of 999). Here is how my statement is written but it is not returning any value. What am I doing wrong? =iif((Fields!MeasureID.Value = 1 or Fields!MeasureID.Value = 16) and NOT Fields!Key.Value = 999, round(Avg(Fields!CY_Rate.Value),0), iif((Fields!MeasureID.Value = 19 or Fields!MeasureID.Value = 20 or Fields!MeasureID.Value = 21 or Fields!MeasureID.Value = 22 or Fields!MeasureID.Value = 23 or Fields!MeasureID.Value = 24) and NOT Fields!Key.Value = 999, roun...

Size e-mail box
SSBmb3JnZXQuLiB3aGVyZSBpbiBFeGNoYW5nZSAyMDAwIEkgY2FuIGNoYW5nZSBkZWZhdWx0IHNl dHRpbmcgb2YgIGVtYWlsIGJveCBzaXplID8/Pw0KDQpTa2FsYQ== Skala wrote: > I forget.. where in Exchange 2000 I can change default setting of > email box size ??? If you're going to change it for a single AD user then this is done by taking Properties of the user in Active Directory Users and Computers MMC > Exchange General tab > Storage Limits. -- Henrik Walther Exchange MVP Exchange-faq.dk MSExchange.org "Skala" <skala12345.tnij.@poczta.onet.pl> wrote: >I forget.. where in Exchan...

Adding ActiveX to dialog with wrapper
When I add an ActiveX object to a dialog using the dialog editor - right click - insert activeX object, the help on the resulting activex selection tool states that a wrapper will not be added by using this method. If you need a wrapper, it suggests using the class view. This is using Visual Studio 2005. I'm having some problems with this on an existing project. To make sure I understand the process, I created a new MFC project, added a dialog, created a class for that dialog and added a Flexgrid object using the right click method in the dialog. I then added a variable for the flexgrid...

duplicating data
I have 2 excel worksheets, both are in different formats. Both will contain the same data but spread across different parts of the worksheets. if I have filled in the data for 1 worksheet, how can i automate this data to be filled into the other worksheet? In Sheet2 use linking formulas. Sheet2 H1 formula is =Sheet1!A1 For contiguous areas these can be copied by dragging. For non-contiguous areas..........manually enter references. Gord Dibben MS Excel MVP On Thu, 1 Apr 2010 08:13:17 -0700 (PDT), Lynn <moley_cruz@yahoo.com.au> wrote: >I have 2 excel work...

Adding alternate columns
I work on a schedule where I record ticket count and ticket sales for each show, listed chronologically. Column A = week ending date Column B = # Tickets sold for April 5 show Column C = Ticket Revenue for April 5 show Column D = # Tickets sold for April 9 show Column E = Ticket Revenue for April 9 show Column F = # Tickets sold for April 12 show Column G = Ticket Revenue for April 12 show Column H = Total # Tickets sold for all shows Column I = Total Ticket Revenue for all shows In the Totals columns, the Total Tickets formula is "+B4+D4+F4", and the Total Revenue f...

Validating data in a subform against data in main form
I have a main form with a subform. Each form is bound to its own table but are linked through a primary key (customerID). On the main form, I have a customer's date of birth (dob). On the subform, I have the customrer's date of order (doo). Basically, I want to validate that the date of order entered by the user is later than the date of birth. How can I do this? I tried to do it in the subform's BeforeUpdate event but it failed. It didn't seem to recognize dob (customer's date of birth). Perhaps, I was not referring to dob properly. I'm new to ...

Adding fields from a different query
I have a form built based on a main query. How do I add more fields on that form that come from a different query? Anne A couple possibilities... Change your first query to include the extra fields. Use your second query to "feed" a form, then embed that form as a subform on your main form. Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudoco...

Make Data available for re-import
Hi can anyone confirm whether the 'make data available for re-import' option when exporting has been removed from CRM 4.0. This used to be available but was wondering if Microsoft have pulled it from their final release. If so would anyone know why, and also if there is a work around available. Regards, Craig Craig - This was available as part of the early access program for CRM, but got yanked prior to RTM. The CRM Team has a workaround that can be found here: http://blogs.msdn.com/crm/archive/2008/01/25/data-manipulation-tool.aspx -- Fortis www.webfortis.com "Craig4s...