How Is RowSource String Entered For ListBox For Excel Form Used As VB6 Designer Control?
I have a very large Excel VBA application that I am moving to VB6 for reasons of code security and execution speed. I've gotten most of it to work. All the forms I imported show up in VB as Designers, but they generally work fine. However, I have several ListBox controls where I specify a multi-column worksheet range in the RowSource property (including displaying column heads). In VBA, I enter the string "'[Workbook Name]SheetName'!Range" as the RowSource property. This does not appear to work from VB6. I assume the reason is I have to somehow indicate the incidence of Excel. How do I do this (or is it even possible from VB)?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Listbox.rowsource + Excel
i want to change the source of a listbox if someone changes the datatable.
my table contains an adressbook a userform with the listbox shows the names:
if i want to add an entry i use a cmdbutton to open another usf with textfields
now if i add new data the table is growing but the source of the listbox does not
so heres my question:
how can i write a code so that with every new table entry the listbox source grows too
i.e. rowsource A2:A50
and after new entry rowsource A2:A51
if somebody isnt sure what i mean please ask and i try to discribe another way
to admin: sorry for posting twice but its very important for me to be answered and i think at this location there are looking more visitors at my thread as in the Excel sub issue
Listbox RowSource Property
I need to list the values that are on a record in Excel on a listbox. These values are listed horizontally but the RowSource property can only list things vertically. Is it possible to do this?
The following is my code (the transpose doesn't seem to be doing anything):
Public Function ListCustomerNotes(ccode As String)
Dim strRowSource As String
z = Workbooks("Tracs Macros.xls").Worksheets("Sheet3").Columns("A").Find(ccode, LookIn:=xlValues, lookat:=xlWhole).Address
z = "A" & Mid(z, 4, 3)
strRowSource = "'[Tracs Macros.xls]Sheet3'!" & Workbooks("Tracs Macros.xls").Worksheets("Sheet3").Range(z, _
strRowSource = Application.WorksheetFunction.Transpose(strRowSource)
.RowSource = vbNullString
'Parse new one
.RowSource = strRowSource
VB6 Listbox RowSource Property
I'm trying to use VB6 with SQL commands to query my Microsoft Access database and return the data into a listbox. My problem is I can't get rowsource to work when I type (for example) mylistbox.rowsource. It says rowsource doesn't exist. I've searched all over the place and I cannot find the way to make it work. How do I activate rowsource and rowsourcetype?
Thanks for any help.
Have Listbox Rowsource Reference External Recordset
In Access, you can populate a listbox with a recordset by setting the the RowSourceType property to "Table/Query" and then giving something like:
lstNames.RowSource = "SELECT [LastName] FROM [tblPeople]"
But this references the current db. What if I wanted to populate the listbox with a recordset from another database? Something like:
Dim db As DAO.Database
Set db = Opendatabase(strPath)
lstBox.Rowsource = db.Openrecordset("SELECT [myField] FROM [myTable]"
...does not work.
Any ideas on this?
Move Items In Listbox (using RowSource From Worksheet)
I have a listbox which has been populated by dropdown lists in a multipage user form. The data has been copied to worksheet manipilated by user and then returned to list box by rowsource from worksheet range. Have no problem deleting rows from list box but have become unstuck on the issue of moving data in list box which refects on the worksheet. The final procedure from this form is to print the data.
Problems Setting Rowsource With Concatenated String???
I have a listbox with a list of client names to select on ..... when you select on it a combo box below is populate (I do this by setting the combo box's recordsource to a sql string:
On the click event, I am having problems with the following:
***The problem occurs in the Select when I try to concatenate 2 field values (FirstName and Last Name) and make them one *****
Clientnum = lb_Clientname.Value
strSQL = "SELECT DISTINCT dbo_tblContacts.Contact_Number, [First_Name]" & "' '" & "[Last_Name] AS test " & _
"FROM dbo_tblContacts INNER JOIN dbo_tblContacts_References ON dbo_tblContacts.Contact_Number = dbo_tblContacts_References.Contact_Number " & _
"WHERE dbo_tblContacts_References.Reference_Number = " & Clientnum & " AND (dbo_tblContacts_References.Reference_Type = 1 Or dbo_tblContacts_References.Reference_Type = 8)"
cmb_requestfrom.RowSource = strSQL
I AM RECEIVING THE FOLLOWING ERROR:
Syntax error (missing operator) in query expression '[First_Name' '[Last_Name]'.
If the above is impossible read below
I also tried to bypass concatenating those strings and instead return each value..... change the column count of the combo box to 4 column widths 0, .3, 1, 1, and bound column = 1 however when I make a selection from the combo box, the it only shows one of the columns ....... this defeats the purpose of what I'm trying to do???
If someone can help or has suggestions it would be much appreciated! Thanks.
Non-contiguous RowSource In Excel Combobox?
Does anyone know if you can assign non-contiguous RowSource to a ComboBox in Excel? If I try to enter a value like:
then Excel crashes on me. Using AddItem is not a practical option because my the list has over 1000 items.
"The face of a child can say it all, especially the mouth part of the face." - Jack Handy
Using RowSource (and An Excel ListObject) In A PPT UserForm...
I'm writing a series of macros that search through a database (Excel ListObject) when the user clicks on an Autoshape during a PPT presentation and then shows a userform with the results.
Right now I'm creating a new, global Excel.Application Object every time the Autoshape macro is run. The database file is then opened and searched (the results go into another ListObject). When I try to populate my form's ListBox, however, I get this error: Run-time error '380': Could not set the RowSource property. Invalid property value.
Here's my code, any input appreciated:
Public Sub SRForm_Reload(Target As String, DatabaseFile As Excel.Workbook)
Dim SearchResults As Excel.Worksheet
Dim ResultsList As Excel.ListObject
Set SearchResults = DatabaseFile.Worksheets("Search Results")
Set ResultsList = SearchResults.ListObjects(1)
' don’t know if I need to hide and re-show form everytime; this is so that the form seems
' to “snap” into its new configuration everytime SRForm_Reload is called
' set column count and column headers
.ColumnCount = ResultsList.Range.Columns.Count
.ColumnHeads = True
DatabaseFile.Windows(1).Visible = True
' populate ResultsListBox with values from SearchResults.ListObject(1)
ResultsListBox.RowSource = "'Search Results'!" & ResultsList.DataBodyRange.Address
' for example, my test case should evaluate this statement as
' ResultsListBox.RowSource = 'Search Results'!$A$2:$M$3
DatabaseFile.Windows(1).Visible = False
This code works fine in Excel; I figured that I could just import it and make a few changes to unqualified references as shown HERE. Obviously that's not the case.
I assume that I'm referencing "Search Results" incorrectly. FYI, the file I'm working from is PAIN_Temp.xls ( aka oExcel.Workbooks(2) aka DatabaseFile).
Using An Excel Column As A Combo Rowsource
I have a user form in Excel and wish to have the rowsource of a combo look up the distinct values in a column. I can set the rowsource to the relevant range, but don't know how to only retrieve the distinct values.
Can anyone help out?
Form To Create An SQL SELECT Stmt For A Combo Box RowSource Property??
As part of the application I am creating, I need to have a pop-up form from whence the user can select from the following:
1... an OptionGroup(s) control providing for ONE selection from multiple fields - a group of fields in the table where only one of the group would be included as criteria in the statement.
2... Combo boxes whereby the list for each box would be set by a SELECT DISTINCTROW statement in the RowSource property for each (i.e. Cities or States). The list would be Unique entries in each field.
A compound SQL "SELECT" statement would be generated and inserted in the RowSource property of the "final selection" Combo Box of the primary form. I assume that altering the combo box RowSource property would occur either on deactivation of the pop-up form or re-activation of the underlying form.
The effect would be that the primary forms recordset would be determined based on these selection criteria. I might add, I already have an OptionGroup control in the primay form which alpha filters the recordset and sets the list for the "final" selection combo box. This new pop-up form sould redefine the primary forms recordset (ApplyFilter) as well as create a list for the "final selection" combo box RowSource property. Anyone who might have created this type code before... please let me hear from you.... if you have an example form, I would very much appreciate it. Thank you in advance!
Variable Value From User-entered String?
I'm not quite sure how to describe what I am asking so I will just give you the situation.
I have a textbox and I want a user to be able to type in a string which will actually be the name of a variable declared in the application and I want a message box to appear with its value.
The only way I can think of for doing is having a select statement and run through all the variables.. but I have hundreds! And I am hoping there is a much better way, although I will admit the request is a bit unusual.
Here's to hoping...
Detecting Changes In The Data Entered In A Form On Form Unload
I have a form with several textboxes. Data can be inserted (created new) or modified through this form. Now what the need is :
if a user enters some data in the form (either in new entry mode or modify mode) and then tries to close the form without saving the entered data, i need to check whether any data has to be saved or not? if data has to be saved then pop up message do you want to save changeS?
how can this be done?
How Do I Assign Items Form A Listbox To A String Array
The registration procedure has made me very very angry, very angry indeed. hehe
Anyway, to make the story shorter, I need a button, when which is pressed, all string items from a listbox will be assigned to a string array. It's got to be dynamic, cuz the amount of items is unknown.
Thanks a lot.
But the way, I kinda love the style here, and I like programming a lot. Hope I can make some friends in here.^_^
Loading Data Entered In A Form Into Another
I am entering data (year, make, model, etc..) in a form other than the main form of my project and saving it to a database. What I would like to do beyond that is once entered into the database, display the same data I just entered on my main form.
So If I entered the year of my car in my "Add New Vehicle" Form, I would like it to also show up on my "year" text box on my "Main" Form. I'm not really sure how to go about this.
Excel Help Needed , Number In Cell Is Not In The Format Entered.
I have a cell which has this in it:
these are actually project numbers that have been entered. I am writing a program to extract these project numbers. Although the cell has the above in it when I look in the equals ( =) section at the top of the sheet the number is displayed as 3.79771137373653E+26 , when I link to access with this spreadsheet this is the value placed in my table and then I cant extract the project numbers from it. Do you know how I can make the number be the way I want in excel and its link to a table.
Cheers , Locutus
How Can I Read Entered Data In Form In Webbrowsercontrol?
I'm working with a webbrowser control and have a question.
When i surf to my testpage i have a form there with a name,adress field
What i want to do is, when i entered the data in the form and click SUBMIT, that the program read the entered data and stores it, so the next time i get to that form it can fill-in the form for me.
Can anyone tell me if it's possible to get the data?
I tried something like this :
For i = 0 To WebBrowser1.Document.All.length - 1
temp = WebBrowser1.Document.All.Item(i).Name
If LCase(temp) = LCase("name") Then
Username.Text = WebBrowser1.Document.All.Item(i).Value: Exit For
But this doesn't work
Thanks in advance
*** Resolved*** Returning To A Control When Improper Data Is Entered
I got some help from a friend of mine (also a member here) who helped me figure out what to do. I use a variable called isLast which I set to the control's name in the GotFocus event, and then when I want to set the focus to the last control I was at I just use this line:
. Now if I could just understand all of it I would feel intelligent Anyway I thank you all for the help.
I use the following code when I test to see if the payment entered in one of 3 textboxes creates an overpayment of the charges. I am trying to return to the last textbox that had an entry into it.
If frmDSReg.lblAmtOwed < 0 Then
MsgBox "There has been an overpayment!" & vbCrLf & "Please recheck the amounts paid!", vbExclamation + vbOKOnly, "Overpayment Warning"
For some reason that I have not been able to determine I end up at a totally different control. Any ideas would be appreciated. Thanks, Later.
Check out my website at http://crogers.org
Being an organ donor is giving the greatest gift that someone can give.
It is giving the gift of life. Please register to be an organ donor.
Edited by - crogers on 7/14/2004 10:16:18 PM
Copy Excel Sheet To A Form's Excel Control
I have an Excel workbook. In this workbook I have a VBA form which contains an Excel Spreadsheet control. I want to copy a sheet from the actual workbook to the workbook of this control in my form. I've searched the forums and learned how to copy, but it doesn't seem to cooperate with the control. Any other methods? Thanks.
Text File To ListBox Via Hidden Excel Form
Sorry guys, still struggling with my listbox, but have another idea as to how I may achieve what I need. Is it possible to import my tab delimited text file into a hidden worksheet then into a listbox? (I am hoping this would overcome a problem I am having to get my columns to line up correctly) Once in the list box, I can delete a selected row, which then saves over the original text file. Is this a long winded way to achieve what I am after?
How Do I Send Values Entered Into A Word Form To An Access Database?
I'm new to VB and need help. My problem is this:
1. I have created a Form in Microsoft Word
2. When the form is completed it has values for each of its name fields
How do I send these values and the names to which they correspond to an Access Database?
Passing A XML String To IE Control Form
I have trouble passing an xml string to a Internet Explorer Component placed on a form. Well, the problem is mainly displaying the xml in the browser...
If I pass html tags, that's perfect but when I pass xml tags (that's when the problem comes: it is displayed simply as text with no formating etc even if I have a style sheet included...
Private Sub Command1_Click()
frmXML.strHTML = "<demographics><Patient><Name>JONES, HAROLD</Name><Acct>1458</Acct><Dob>09/17/1955</Dob><Age>33</Age><Sex><item name='M' status='yes'/><item name='F'/></Sex><Rel-guar><item name='S Self'/><item name='P Spouse'/><item name='D Dependent' status='yes'/><item name='C Child'/><item name='O Other'/></Rel-guar><Ssn>822 22 225</Ssn><Address-1>414 S.Evergreen</Address-1><Address-2>3131 Sea Food Drive</Address-2><City>Skokie</City><State>IL ILLINOIS</State><Zip>60558</Zip><Home-phone>848 299 3983</Home-phone><Work-phone>887 270 8336</Work-phone><Pr-code>WE EHLERS, WILLIAM</Pr-code><Ref-phys>FD FRANK, DEMAURO</Ref-phys><Diag-code>159.0 COUGH</Diag-code><Med-record>40375B</Med-record><Adm-date>21/03/1990</Adm-date><Dis-date>01/04/1980</Dis-date><Notes>Really nice guy</Notes><Case><item name='Patient' status='yes'/><item name='Guarantor'/></Case></Patient></demographics>"
Anyone has an idea what am I doing wrong?
thanks a lot
How To Search In Listbox The Value That I Entered In Textbox Using "Text1_Change()" Method
Private Sub Form_Load()
Private Sub Text1_Change()
//what coding i will do here to search if i press "c" in textbox then first name of all of the string's starting with "c" in listbox get green i.e ["cairo", "caspen", "china"]. and if i then write in textbox "ca " then two string values i.e ["cairo","caspen"] get green in listbox.
I have recently had VB 6.0 instaled on my machine. I am needing to edit a form however the entire form toolbox is inactive. Does anyone know what components / libraries I need to have loaded to resolve this issue?
I receive the following error message when attempting to use the toolbox:
This control cannot be used with Form Designer.
Thanks for the help
Where can i get a form designer? Please help, this is urgent.
I need an application or a control which
provides "Form Designing" facility like VB IDE does. I want to provide this facility to end users so that they can design their own forms and bind with the database. The forms can be saved in database or external files. The oher question is what about code? How can I provide facility for
handling events code to users?
Can anybody help me?
Validating Date Entered To Period Entered (which Corresponds To A Date Range)
I am trying to create a macro in excel that compares a date entered (YYYYMMDD) and a period entered (1-13) to see if the date entered matches the dates of the period entered?
(E.g. Date - Cell B3 = Entered 20040412 (YYYYMMDD)
Period - Cell B4 = Entered 12
Since period 12 respective dates are 20040404 thru 20040501 macro should return message saying valid date and period
Date - Cell B3 = Entered 20040412
Period - Cell B4 = Entered 11
Since period 11 respective dates are 20040307 thru 20040402 macro should return message saying invalid - date and period do not match)
edit:: Moved to VBA (Sorry, I have no answer for you)
Edited by - Metallisoft on 4/13/2004 11:04:34 AM
Map Designer As VB 3rd Party Control
Do you know if there is a 3rd party control which enables to draw detailed maps (towns, ports, depots, etc...).
The only I know is The HotSpotImage where you can draw lines onto a existing picture or drawing, so that each of the parts created are event sensitive in VB code. But unfortunately this control does not enable to draw sideways lines.
Can you help me?
Thanks and regards
Control Designer Opening In IE
I am designing a custom ActiveX control with VB6. When I try to test it, instead of opening on the test form it places the control on an HTML and opens in IE. How do I change this back?
Custom Designer Control
Is there anyway to create a user control so that it acts like the datareport or form designers in VB6, and add it to your project? i.e. the designer has it's own window.
Most user controls I've seen need to be added to a form.
Control Designer At Run Time
I wana to programe a control such as form designer control as you see in design time of form, in this control at run time when I add a leble contol I can select it , and move it to to the my favorite position, or I can resize it as such as design time in VB form designer. How can I do it?
This Control's Designer Is Open
To use the control, you must first close its designer (design window).
This error occurs when i want to use a user control (ctl) in a form? How to resolve this?
Form Designer For Assembly..
I really don't know how to start this.. this is for my school project... is it really possible for me to create a form designer for HLA (High Level Assembly)??? Anyone wanna share their thoughts about it? thanks
How To: Mimic VB's Form Designer.
Hi all, I think the title pretty much says it all :-). Has anyone tried to do this and/or happens to know how and could point me to a URL or a source file somewhere that does this? Basically, I would like it to:
1. Show a Form inside another form (like VB does when designing forms)
2. Show the Size handles so I can move/resize controls on the form and the form itself (again like VB Does).
that's all I'd like. I'd add in whatever else I need. :-).
Hoping someone knows what I'm talking about and can help.
P.S. I've tried using the SetParent API which at least does constrain the child form inside the parent form sorta like VB does but as soon as i try to give focus to that form inside the other, it appears as a new form and that new form isn't constrained to any other.
Report Designer Form
Can anyone out there give me a hint as to where I can find a "How to Use" guide for Reports Designed with the Report Designer?
Example(s) would be great!
I've designed a report. The next step is to use that Design to build a report.....hmmmm...
I'm presuming that one loads the report text fields as per a form, but how much of the page throw control/page counting is available as an automatic functionality, or is that all manual?
Does one copy the loaded report to a file, or is the form thrown at Printer.Print?
And any other pertinent things I haven't thought of yet...
Edited by - JA1 on 7/11/2005 6:20:10 AM
Eporting To Excel Using Data Report Designer
I am using vb6.0 and am writing a Data Project. Using MS Data Report Designer for the reports.
The default Report export formats are txt and html. I was wondering if sumone can help me with how i can enable export to excel and/or pdf formats too in addition to html and txt.
thanks in advance!
Crystal Reports 8.5 Designer Control
I have created a crystal report from crystal reports 8.5 designer component in visual basic 6.0 with a stored procedure.
In visual basic i adde a CRViewer control on the form and with the help of this control i display crystal report's result in this conorl. Now problem is that in an other report i have passed a stored procedure having parametres. How can i pass parametres to access craystal report or display crystal report in the CRViewer control from visual basic code. I need sample code for this task please help me...
Annoying Form Designer In Vista
Has any of you have any experience with VB5.0 or 6.0 under Vista?
When resizing controls on a form, the size-rectangle is hardly visible or flashing like a maniac.
Is there any solution available for this?
A Newb Designer Form Question.
Ok, hopefully i can explain my problem.
I created a form with various VBA stuff in Excel and tried to import into VB6.
It worked fine and I can create an exe, which works fine.
The problem I have it that the form is located in the Designers folder in the project window. When I select it I cannot add to the form. I can modify the existing stuff, but cannot add anything new. The toolbox window is greyed out.
What I am doing wrong? Or is there a way to move a designer userform to make it a normal form.
Pass A Value From A Form To A Data Designer
I am trying to generate reports using the data designer.
I have a form with a dropdown combo and a button. I select one value from the dropdown combo. When I click on the button 'Generate Report', I want the report to be generated. I am successful in passing the control to the .dsr file.
However, I do nt know how to pass the value inside the combo box to the designer so that the appropriate table can be queried to retreive the values.
Any ideas? Is such a thing possible. Plz help me with code snippets. Please help me to know how do I pass the value inside the combo from the form to the datareport1.dsr file.
Builders / Form Designer / Selected Controls
I am familiar with Visual Studio Builders in Vfp and would like to use them in VB; e.g. to save time generating code for complex controls. (Where 'Builder' == 'Wizard-like' tool).
In a small group (3 programmers) we all have the same situation:
MSDN Help states that in Form Designer the (right-click) Shortcut Menu should include a Builder item for a selected control.
It also states that if an item is selected which does not have an associated builder, a dialog box should appear stating that no builders of that type are registered.
My reight-click menu (and that of my co-workers) is different: no Builder item plus other menu item discrepancies; no messages about unregistered builders.
Our systems guru installed all 3 copies of VB from the CD labelled: Visual Studio 6.0, Enterprise Edition, Discs 1 - 3, and claims to have performed full installations - no missing options.
The only slightly odd thing I am aware of is that the folders for Vc98, Vfp98 and VIntDev98 lie under C:Program FilesMicrosoft Visual Studio whereas MSdn98 and Vb98 lie under D:Program FilesMicrosoft Visual Studio i.e. different partitions of the same hard drive. I see no .exe's or .dll's with file names that suggest builders.
Any ideas on how to get the builders up and running would be greatly appreciated.
Thanks in advance,
Forms 2.0 Designer Combo In Simple Form
I know that the Combo that comes with MS Forms 2.0 Designer can show multiple columns.But the problem is that I want to insert this combo in one of my existing applications.BUt VB does not allow it to be put on a simple form,but only on the form that pops up with the Designer.
Thankx in Advance...