VB Datagrid To Pull Access File.
I'm trying to make a Flexgrid program that will enable me to press a command button to go to the next table in an Access file. Every time the com2 button is pressed - then Cate = Cate+ 1 (Cate being the table number(1-13 in this case) viewed by the user Tabl(1-Cate) is the name of that Table. For example: Tabl(1)="Bills"
Here's the program so far:
Option Explicit ' Note: 'Dim' will work the same as 'Private' here ... Private Cate As Integer Private Tabl() As String
Private Sub Form_Load()
Dim db As Database Dim td As TableDef Dim intX As Integer
Set db = OpenDatabase("C:My Documentsphone numbers.mdb") For Each td In db.TableDefs ' There are hidden, system tables in an Access DB ' that start with "MSys", which you want to ignore If Left$(td.Name, 4) <> "MSys" Then intX = intX + 1 ReDim Preserve Tabl(1 To intX) Tabl(intX) = td.Name End If Next db.Close
Cate = 1 dbPhone.RecordSource = "SELECT * FROM " & Tabl(1) End Sub
Private Sub com2_Click() Cate = Cate + 1 If Cate > UBound(Tabl) Then intCate = 1 dbPhone.RecordSource = "SELECT * FROM " & Tabl(Cate) dbPhone.Refresh End Sub
**** Now my question is: When I run this program - I get an error message: ** The Microsoft Jet database engine could not find the object "SELECT * FROM Bills." Make sure the object exists and that you spell its name and the path name correctly.
Now when I pull up the Access file (phone1.mdb) the first table is Bills. The first column is Bills/Phone Number/Address/Account Number/Notes What I think the reason for the error is the fact that it is searching for "MSys" Does anybody else have any other ideas: For a more fuller explanations look up web page: http://forums.vb-world.net/showthrea...9328#post89328
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Pull Information From Access To VB.
I am using Visual Basic 6.0 Professional. What I am looking to do is simply have three fields on a VB Form, type a number into the first field and have it pull the matching information information from an Access database to the other fields. The number I would type in would be the key field in Access.
I am really new to VB and read the tutorial that was listed at the top of this board but it seemed to have focus on just pulling the information over. Does anyone know a good tutorial for what I am trying to do?
Sorry to bother everyone.
Pull Data Into An Access DB
Hello,
I need to pull data from a flat text file and then place that data into a microsoft access DB. The layout of the file is like so
20060115,1030,3,115,421.22
20061115,1112,4,116,333.45
Etc....
The first field is date, second is time. I want to pull this data into an access DB and sort it by date, time and the fourth field.
Any ideas?
Thanks
ADO Won't Pull Records From Access Top To Bottom...
As the subject states, why doesn't my ADO through VB 6 pull my Access records from top to bottom? I use the .movefirst and .movenext, but it hardly ever pulls two records in any certain order... How can I make it pull from the top of the table down?
SQL String To Pull Records, Access && ASP
Hi Guys,
Im having some trouble with an SQL string Im using to pull records from a database,
It is working but its not pulling all the records and its the Fname field Im messing up on with my var Name1
I wonder if anyone can advise me on whats going up.
My var and string I have just now is:
Code:
MySQL = "SELECT * FROM MyTable WHERE field_a is null And field_b Like '" & sex &"'" & " And body Like '" & Body &"'" & " And Fname LIKE '" & "%" & Name1 & "%" & "'"
Thanks again for any thoughts.
L
Unable To Pull Information From Access DB
I am trying to use an sql statement to retreive data from an access database using "Like" but it doesnt seem to be working. I have a field called LName which contains last names. I am trying to select all last names that begin with "A". I have verified that there are several names starting with "A" and the field and database names are correct. If I go into access and create a query and view that query it collects the data correctly. Also if I use the same code below without the Like it pulls in the entire database correctly.
SetNavButtons 3
Set conMyDB = New ADODB.Connection
Set rsCust = New ADODB.Recordset
conMyDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & _
"phonebook.mdb"
conMyDB.Open
rsCust.Open "SELECT * FROM tblCust Where LName Like 'A*' Order By LName", conMyDB, adOpenDynamic, adLockOptimistic
PopFields
SetFields False
SetActionButtons 1
I also tried saving the query in access and calling it from VB with the same result. The result is Either EOF or BOF is true. basically it seems it is not pulling in any data.
The syntax I used to try and call the query is below. Either method will be fine. I just need to get one or the other to work.
'rsCust.Open "SELECT * FROM qryA", conMyDB, adOpenDynamic, adLockOptimistic
'rsCust.Open "qryA", conMyDB, adOpenDynamic, adLockOptimistic
Any help would be appreciated.
Access- Pull Up Same Record After Form Closes
I have a form that I am using to work a report. I have the form programmed to save the account number into a table of the record that was last viewed upon unload of the form.
Now I need to find a way to pull up that record in the form when it opens again.
For example, if I have 100 records in my form. I stopped at record 35 at the end of the day. I come back the next day and open the form, it is on record 35 of 100. all the work I did yesterday is 1-34.. help please!!
Pull Info From My Access Database....into Word?
I have a letter that has been created in word, I also have a database of names and info. If I select a person from the database how can I get like the persons names to insert into the Letter I have written in word?
I hope this makes sense and someone can run me through how to do this? thanks!
Using VBA To Pull-out From DATABASE(ACCESS) To A Spreadsheet(EXCEL)
I was making a VB Application and i'm having a problem of using the method of pulling-out the record from the database using with the vb application to transport to a Spreadsheet when a bigger record is handle. Kinda the VB Application is going to halt or hanging out...
Is there a way of maximizing the performance of the application?
Can you help producing a code for the to pull-out record ? with reliable performance that much better....
thnx to you ......
irvin
-=-
__________________
ambs
Using VBA To Pull-out From DATABASE(ACCESS) To A Spreadsheet(EXCEL)
I was making a VB Application and i'm having a problem of using the method of pulling-out the record from the database using with the vb application to transport to a Spreadsheet when a bigger record is handle. Kinda the VB Application is going to halt or hanging out...
Is there a way of maximizing the performance of the application?
Can you help producing a code for the to pull-out record ? with reliable performance that much better....
thnx to you ......
irvin
-=-
Pull Info From Access Database Into Text Boxes
I have an Access Database with 3 tables: Customer, Software, Computer.
I have linked the VB 6.0 Form to this database with a data control as well as linked the text boxes to the correct fields in the linked tables in the Access database. I have a command button that I would like to activate a search of the database which will fill in the text box fields on the form with the information from the database when it finds it.
Example: I enter a customers social security number in a text box and click the search button; It should then automatically search the databse and fill in the customers name, address, phone number, etc in each seperate text box. Can you please provide me with the code/commands that I need to do this?
This is going to be used to track the software products that a customer has on his current machine. One potential problem that I anticipate having is when I search for a customer and all his info comes up including his pc information and software loaded on it......If the machine has more than one piece of software, how will the search find it?
It is my hope that I will have most all of the information in all 3 tables linked to the record I am searching for to fill in the text boxes I have created when I perform this search.
Pull Path From A Txt File
Hi, is there a way i can pull a path from a txt
i.e
the txt file has 4 lines
1. d:/images
2. e:/folder
3. d:/images/something.jpeg
4. e:/folder/something.jpeg
and say if on a form i want to loan line 4 into a text box, how would i do it
Thanks Adz
p.s im really sorry for all the threads, it just how i learn best
Thanks Adz
Pull Comments Off Of A File
I'm curious as to whether it is possible to pull the Comments off of a file. What I want to do is scan a folder for .csv files, and then gleam a friendly name for the files from their comments. I don't want to add an extra field to the spreadsheet because when I load the file, it generates information and program elements from the fields in the database. Any ideas on how to read the comments?
Datagrid Without Access File
Hey
is there a way to type data into the datagrid without connecting to a database ... i have tried but i dont know what properties i have to set
cheers
How To Pull Values From File Properties?
Hello,
How do I access the properties of a file and pull values to be used in my program....for executing, renaming etc.
I am interested to learn how to tell a file from shortcut and if its a shortcut then follow the path, or url and do whatever with it.
is that something to be done using api? which procedure? what lib? who's on first?LOL
Thanx for any help!
How Do I Pull Out Data From Tables In An RTF File?
Hello,
I am currently using a database to hold information and convert it to an RTF file to use with Visual Basic. The RTF file has tables that display information I need. I am trying to get only a couple rows out of the tables and display it in a user interface I made. I cant search for specific text because the data could change and I wont know what exact text to look for. Also, the table wont be on the same line every time I convert the RTF files from the database files. Could you point me in the right direction of what I should do and what functions I should be using.
Thanks
Browse For A File And Pull Details
I am trying to figure out something that is proving to be more difficult than I thought. I need to open a File Browse window and then select a specific file and somehow detect and list the files Version number and Data Modified. Any Ideas?
Mike
How To Pull Data From Txt File Into Database Table ?
Heya
I want to pull data in Txt file to a Database Table. My data text file is in the following format :
serialNo, Name, Age, Tel , Job , comments <NewLine>
example:
234, Andrew , 25, 23434345, Programmer, Very good
235, Saif, 24 , 234433345, Data Entry, Excellent
I want to pull these data into Ms Access DB Table, containing the follwoing fields:
serialNo
Name
Age
Tel
Job
comments
How to do that ? is there a particular Ole DB Driver can be used ? any suggestion ?
Thanks.
MS OUTLOOK VB/VBA >< Pull A Person's Calendar And Write In A Text File.
Date: 01/11/2004 03:58AM MHT
hi experts
I am am VB6 programmer , my company has asked me for
We need some VBA work that will interface with Outlook or MS Exchange server and pull a person's calendar and write in a text file.
Please see how much work is involved in this.
Can I do this in VB or I have to use VBA ..
Please provide the amount of work required and where would I do the development .. in Ms office VBA env or VB env
regards
Ade
Datagrid1-ACCESS-SQL SELECT-Tie A DataGrid Click To Non-Indexed ACCESS Record?
This last post was "DataGrid -how do I tie a mouse click back to the database?"
I had an indexed ACCESS database and I was able to identify which record I clicked on by obtaining the record "ID" using: TheRecordID = Adodc1.Recordset("ID") - thus that identified the unique record in the ACCESS database.
The problem has a different twist ... there is no "ID" in a non-indexed database.
Since one can obtain a Recordset from a non-indexed ACCESS file, modify it and update it using, for example: Adodc1.Recordset.Update ...
It would seem that VB must knows which record is which!
There must be a way one can get this info, and know which record was clicked on.
It is easy to know which Recordset record number; but how about which ACCESS database file's record number?
Bob
Set End Of File Or Convert The VB-file Access Number To A API-file Access Handle
Hi,
I've opened a file with binary access. The size of the file is x.
Now I want to cut the file to get a shorter size (new size < x), but I don't
want to close the file, delete it, create it again and write the shorter content to it. There is a C-API-function SetEndOfFile(), is there any VB-pendant ?
Or how to convert the VB-file access number to a API-file access handle ?
Thanks,
Andy from europe (Germany)
See If One Of You Knows How To Pull This Off...
I want to put a pass on a cd. To be more specific, When the cd is loaded, the autorun.inf runs a program which brings up a form telling you to enter a password. If the password is wrong I want to know how to make it eject the cd.
Sql Pull
I am trying to pull a table from my sql server, I just need to know what the initial catalog is refering to in this line of code:
Dim rdaOleDbConnectString As String = _
"Provider=sqloledb; Data Source=Brianp_DSK;Initial Catalog=Medic; " + _
"User Id=;Password="
I am trying to connect to an sql server ce database I have seen examples where they put Northwind as the Initial Catalog. Could anyone explain to me what Initial Catalog is?
If...then Pull Hair Out
Hi,
I've been having trouble with some code. I have a set of coefficients for equations, stored in arrays. The code is suppoed to select which set to use.
Code:
Range("H1").Select
For cnt = 0 To FloodDuration
ActiveCell.Offset(cnt, 0).Value = cnt
Next cnt
Range("I1").Select
For cnt1 = 0 To FloodDuration
' Select Case cnt1
' Case x(0) To (x(1) - 1)
' cnt2 = 0
' Case x(1) To (x(2) - 1)
' cnt2 = 1
' Case x(2) To (x(3) - 1)
' cnt2 = 2
' Case x(3) To (x(4) - 1)
' cnt2 = 3
' Case x(4) To (x(5) - 1)
' cnt2 = 4
' Case x(5) To (x(6) - 1)
' cnt2 = 5
' Case x(6) To x(7)
' cnt2 = 6
' End Select
If cnt1 >= x(0) And cnt1 < x(1) Then cnt2 = 0
If cnt1 >= x(1) And cnt1 < x(2) Then cnt2 = 1
If cnt1 >= x(2) And cnt1 < x(3) Then cnt2 = 2
If cnt1 >= x(3) And cnt1 < x(4) Then cnt2 = 3
If cnt1 >= x(4) And cnt1 < x(5) Then cnt2 = 4
If cnt1 >= x(5) And cnt1 < x(6) Then cnt2 = 5
If cnt1 >= x(6) Then cnt2 = 6
qa = Aval(cnt2) * (cnt1 - x(cnt2)) ^ 3
qb = Bval(cnt2) * (cnt1 - x(cnt2)) ^ 2
qc = Cval(cnt2) * (cnt1 - x(cnt2))
qd = Dval(cnt2)
q = qa + qb + qc + qd
ActiveCell.Offset(cnt1, 0).Value = q
Next cnt1
As you can see, I've tried a couple of methods, but I have the same problem with each: It uses the A(0), B(0), C(0) and D(0) coefficients for all the values of cnt1, until it reaches the switch for the 7th set (cnt2=6) of coefficients. So, it correctly uses the first and last sets, but doesn't switch for the middle sets.
Any suggestions?
Pull Text
Hi all,
I am working on a text problem and have tried several ways but none do it properly.
I need to separate text from a text box and put it into another.
The data is in Text1 like this: XX"DFRgt53td"ZZ
XX" and "ZZ are the only constants, the data in between them is always different.
Also these are surrounded by other data, here is an example of actual data:
647655 gtr54545eeXX"7665trgdf45rwf"ZZi 756hjff XX"u54ty934 23t24r re"ZZ4536rf
So as you can see above the data is embeded into other text. So I need a process to run and if the above example were entered into Text1.Text, then transfered to Text2.Text would be:
XX"7665trgdf45rwf"ZZ
XX"u54ty934 23t24r re"ZZ
Thx
Is There A Way To Pull Code From A Vb.exe?
Just curious if there is a way to pull the code out of a program that was made with VB? Or maybe a program that does it?
I was wanting to look at a small program
Thanks in advance!
Pull Down The Combo Box
I have textbox and combo box.
How I can pull down the combo box, when I try insert the value in the textbox?
Pull Down Menu
i want to do a pull down menu, im not quite sure wut the code is though. so i make a combo box. now what is the code so i make another option.
Combo-Box Pull Down
Does anyone know how to activate the pull down list of a combo box when anything is typed in the combo box?
Pull Down Menu
I have a pull down menu with a top level name of tools.
I want to dynamically add sub entries to the tools pull down based on the tools installed on that machine.
I can search a specific directory and determine the available tools.
I do not want to just dis-able them. There are 15 of them and most of them are mutually exclusive. Administrators have tools that customer service people don't have access to and the managers don't want the customer service people to even know the tools exist.
so
File Edit View Tools Help-
-save -cut -bla -lookup -contents
bla
bla
bla
the lookup needs to be dynamically added .
thank you for your time and have a good day
PS planning on the form activate event.
Whats The Best Way To Pull This Off?
I have a main form, always loaded with a winsock control listening for connections, When someone connects, i want to open a new window, Which has 2 more winsock controls on it.. and connect them both up to winsock.remoteip on the main form..
What do you Personally think the best way to do this is?
My way seems kinda sloppy...
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim StrData As String
Winsock1.GetData StrData
' If the remote user is sending the correct handshake command, Forward the user to the message window, and connect.
If Left(StrData, 3) = "HI:" Then ' HI:Username is our handshake command
Set mx = New fMsg ' Create message form
mx.RemoteName = Mid(StrData, 4, Len(StrData)) ' Remote Username ( Next to our handshake command )
mx.RemoteIP = Winsock1.RemoteHostIP ' Remote ip
mx.wChat.Connect mx.RemoteIP, 5556
mx.Show
Set mx = Nothing
Winsock1.Close
Winsock1.Listen
Else
' Remote user didnt send the correct handshake command. Close connection and wait for another.
Winsock1.Close
Winsock1.Listen
End If
RDA Pull Error
I installed ssce 2.0 server tools service pack 3 because i installed sql server 2000 service pack 3.I did this beccause
i want to use RDA pull method to access database tables from sql servver to the database in ssce.
It is not showing any tables in the database except the system created one.
The code i used is this one. I am not getting any error except i cannot see any table name -which i specified authors in my case
Dim ceRDA As SSCE.RemoteDataAccess
Dim oCatalog As ADOXCE.Catalog
Dim sSvrCon, sLocalCon
' Delete database if it already exists, and then create
On Error Resume Next
If FileSystem1.Dir("check1.sdf") <> "" Then
FileSystem1.Kill "check1.sdf"
If Err.Number <> 0 Then
DisplayError "Deleting database:error "
Exit Sub
End If
End If
Set oCatalog = CreateObject("ADOXCE.Catalog.3.1")
If Err.Number <> 0 Then
DisplayError "Creating ADOXCE.Catalog object: "
Exit Sub
End If
lblStatus.Caption = "Creating local database"
sLocalCon = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;"
sLocalCon = sLocalCon & "Data source=check1.sdf"
oCatalog.Create sLocalCon ' create the database
If Err.Number <> 0 Then
DisplayError "Creating Database:error "
Exit Sub
End If
Set oCatalog = Nothing
lblStatus.Caption = "Connecting to remote server"
'create the RDA object
Set ceRDA = CreateObject("SSCE.RemoteDataAccess.2.0")
If Err.Number <> 0 Then
ReportEngineErrors "remote connection error:", ceRDA
Exit Sub
End If
' set RDA properties
ceRDA.InternetURL = "http://localhost/sscePubs/sscesa20.dll"
'ceRDA.InternetLogin = "root"
'ceRDA.InternetPassword = "mathew2"
If Err.Number <> 0 Then
ReportEngineErrors "url error:", ceRDA
Exit Sub
Else
MsgBox "url connection est."
End If
'lOCAL CONNECTION
ceRDA.LocalConnectionString = sLocalCon
If Err.Number <> 0 Then
ReportEngineErrors "local connection error:", ceRDA
Exit Sub
End If
' enable this line if SSCE Relay is used
'ceRDA.InternetProxyServer = "ppp_peer:81"
sSvrCon = "Provider=sqloledb;Data Source=(local);Initial Catalog=pubs"
'sSvrCon = sSvrCon & ";user id= sa"
'sSvrCon = sSvrCon & ";password= mathew2"
lblStatus.Caption = "Pulling Authors"
ceRDA.Pull "authors", "SELECT * FROM authors", _
sSvrCon, TRACKINGOFF
Set ceRDA = Nothing
let me expalin some more. i created virtual directory.I could see sql server ce server agent when i enter.
http://localhost/sscePubs/sscesa20.dll when it is offline.
I am wondering if there is any error in this code:
sSvrCon = "Provider=sqloledb;Data Source=(local);Initial Catalog=pubs"
I can see pubs database when i go toSQl server enterprise manager.In that page under console rootmicrosoft sql servers- there is two items sql server group and Thomas which is my server name.under thomas i have local server .ie Thomaslocal(windows NT).
I am wondering if i need to change my data source path and initial catalog path. so that it will access the pubs database.
when i run this code,it creates the database and under tables folder ,system tables like MSystemConstraints and two other system tables.
I appreciate some ones help asap.
Pull Down Menu
Anyone can help me.
How can i disable my pull down menu during runtime,
For example :
File
--Test
--Close
How can i disable Test during runtime ?
Thanks alot.
Pull Down Menu
I have written an program witch has a pull down menu. I want to make at run time new etries in the pull down menu. At the moment I have 10 etries witch are hidden. When I want to make a new one, I set it to not hidden. But with this methode I can only add 10 new entries.
How can I add more entries. Is there an add methode or any other methode witch I can use.
mfG Pueromane
CRC32 - Need To Pull The CRC From A *.dll
Hi,
Nobody will probably be able to help with this, but here it goes anyway.
If I have a .dll in the root of any directory, for example on a system running US Office C:\Program FilesCommon FilesMicrosoft SharedProofMsspell3.dll
and Msspell3.dll being the target; I want to find the CRC32 of this file?? how would I approach this problem with regard to the actual code to pull the CRC32 from the file?
I am aware of the following Construtors and methods, but I do not know how to implement them.
CRC32()
getValue() Returns CRC-32 value.
reset() Resets CRC-32 to initial value.
update(byte[]) Updates CRC-32 with specified array of bytes.
update(byte[], int, int) Updates CRC-32 with specified array of bytes.
update(int) Updates CRC-32 with specified byte.
If anyone could help I would much appreciate it..
Thanks in advance..
DataGrid On Access?
Im new on access databes, and I have trouble, could any tell me how can I make a "DataGrid" on access formulary, I could find this element that I use on Visual Studio on access =(, on by the way tell me what is the element that do the same on access =D
Access Datagrid
Need a little help with this:
i have a recordset in VBA that contains a JOIN, now i want to display this data in a dbgrid... Added the dbgrid onto the form (MICROSOFT Datagrid Control 6.0 SP4). Now i want to assign the recordset to the datagrid, in VB this is DBgrid.Datasource = recordset, but there isn't even anything that looks like this in VBA.
Is there anyone who knows how i still can assign my data to the grid?
Tnx in advance
Access And Datagrid
I am currently using Access as my database and adodc as the control. The problem is that even though the records appear sorted when viewed in access according to a primary key, the same order does not appear in the datagrid i use or when i access the records using vb. This is important cos the incorrect order in which the records are sorted will screw up the way my primary key is generated. Thanks.
Datagrid And Access
How to set access table as a datasource in data grid control. i tried and succed in sql tables. can any one help me
Help With Access DB And DataGrid
Hi
SInce this is my first work with Access DB and the Datagrid, i would need a little help. I have already built my Access DB File that contains 1 table called "Table1" and that table contains 4 fields.
in my VB code:
How do i write to my Access DB using an ADODB Recordset?
How do i read a specific cell on a specific row of my DB?
How do i clear all the data in my VB (just keep the Table and Fields name)?
thanks in advance
Martin
Physics: Gravitational Pull
I want to simulate atoms... i use the formula F = G*m1*m2/d^2 and then to determine how fast they move toward each other i use F = m*a, i isolate a = F/m and i determine the acceleration toward the other object.... but this is where i am stuck... i want to add more atoms, not just 2, and i will probably need vector math to determine how the vectors cancel each other out.
Did i start something that is really too hard for me ? This is my code so far
Code:
Dim F As Double
Dim G As Double
Dim d As Double
'type
Private Type o
X As Double
Y As Double
m As Double
v As Double
End Type
'declarations
Dim o() As o
Dim i As Integer, j As Integer
'initialize
Private Sub Form_Load()
G = 6.673 * 10 ^ (-11)
ReDim o(1)
'initialize masses
For i = 0 To UBound(o)
o(i).X = Int(Rnd * Form1.ScaleWidth)
o(i).Y = Int(Rnd * Form1.ScaleHeight)
o(i).m = Int(Rnd * 100) + 1
Next i
End Sub
'timer control
Private Sub Timer1_Timer()
'draw them
For i = 0 To UBound(o)
Form1.DrawWidth = o(i).m
Form1.PSet (o(i).X, o(i).Y), vbBlack
Next i
'do the math...
For i = 0 To UBound(o)
For j = 0 To UBound(o)
If i <> j Then
'calculate distance between objects
d = Sqr((o(i).X - o(j).X) ^ 2 + (o(i).Y - o(j).Y) ^ 2)
'calculate force
F = G * o(i).m * o(j).m / (d ^ 2)
'adjust acceleration of object
'Side note: I know the o(i).m cancel out, but just for clarity i left it
o(i).v = o(i).v + (F / o(i).m)
'what do i do with this velocity now ??? it has to have a direction, not just a number!
End If
Next j
Next i
End Sub
Pull Data In Chart
URGENT!!
Just wrote a macro that
1) deletes the existing column chart
2) creates a new chart with one data entry
3) updates the chart by pulling additional input data into the chart. Both the chart and the input data are located on the same sheet.
The program is running.
If I want to apply the same macro on a different sheet in the same workbook by only adjusting some data ranges and sheet/workbook names a weird error occurs:
"Run-time error '5': Invalid procedure call or argument"
The debugger flags the following line of the source code:
ActiveChart.Location Where:=xlLocationAsObject, Name:="Total Amount of Claims per Year"
Despite the above line, the new chart is inserted on a new sheet. It should be inserted on the same sheet that contains the input data. Do I have to put in "other words". It seems that there is no logical and semantically mistake.
Here is a part of the source code including the critical line:
'create chart
Range("A1").Select
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Total Amount of Claims per Year").Range("B2"), PlotBy:= _
xlRows
ActiveChart.SeriesCollection(1).XValues = "='Total Amount of Claims per Year'!R1C2"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Total Amount of Claims per Year"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Total Amount of Claims per Year"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
I appreciate any advice or question as this is a really urgent project.
Thank you.
Pull Down Sheets Tabs
I have seen this somewhere before so I know it is possible.
I want each sheet label ( The ones with the different worksheets names on them) to be a drop down where I can select multiple sheets.
Please help.
|