Replicating SQL Primary And Secondary Key Lookup
Nov 15, 2011Is it possible to use a formula to replicate primary and secondary lookup in SQL and is it possible to retrieve data from Excel spreadsheets using SQL.
View 1 RepliesIs it possible to use a formula to replicate primary and secondary lookup in SQL and is it possible to retrieve data from Excel spreadsheets using SQL.
View 1 RepliesI have been trying to break my new chart that combines stacked bars on the primary axis with their labels on a transparent line graph tied to the secondary axis. The secondary axis allows me to show the labels I want as categories and position them relative to the visible part of the stacked bar (waterfall style) proportionately outside of the bar. The trouble comes when my label positioning is less than or more than the primary boundaries. I can solve this manually by changing the max or min value of the secondary axis, but what I really want is for the secondary axis to be locked to the primary axis' max and min automatically.
View 2 Replies View RelatedIn VBA, how to add a secondary x-axis in the lower portion of the chart if I already have the primary axis in the upper part?
This code
ActiveChart.HasAxis(xlCategory, xlSecondary) = True
just adds it to the upper if I have the primary at lower.
I have a chart with sales data on one axis and inventory on a secondary axis. I have the average of each columns of data and want to add a reference line to each axis with it's average. I have added the averages to my data set, but it only adds the reference line to my primary axis. I actually began by manually inserting two lines to the chart (which seems asinine). They actually didn't print because they weren't actually on the chart, but rather just on the spreadsheet behind.
View 5 Replies View RelatedI have some data which I need to replicate, the data is as follows:-
Club : Name : Competition : Division : labels per round : number of rounds
this is in the six columns as above and, perhaps, 900 rows.
What I need to do is to read each record in turn and replicate it by
a: the number of "labels per round" then
b: the number of rounds, incrementing the round number from 1 to 10 in the process.
This would be written to another worksheet.
I have tried to come up with some VBA to do this, but even this simple task would appear to be beyond me in the timescale I have to get it sorted. how to code this or point me to where I can find this out?
I got a workbook containing a worksheet called APheb1.
I would like to create a macro that would replicate this worksheet and rename it APheb2, APheb3 etc... till a number i specify. For example if i specify 90, then it would replicate APheb1 90 times till APheb90.
I have recorded a macro that replicates the file but i cannot find a solution for the renaming part.
I have this excel template which i am working on and its a bit kind of complex linking several sheets together.
My problem now is in the Junior STUDENTS INPUT.xls
the 2nd term report has to be replicated 150 times following the patter of the one already done linking all necessary cells as the first one,
see the attached "sample.xls". In cell "D1", after I typed in some text and pressed enter, the cell format changed. It only happened for texts not for numbers. There's no macro or conditional format that I could find.
View 2 Replies View RelatedHere is something I have found while sorting data from a much larger spreadsheet but is quite disturbing that Excel will not sort very specific lines based upon a secondary value. From the data below try the following:
Select all the data and sort the rows by a primary column of E and a secondary of D both "Descending" and no header row of course.
In my Excel 2003 on two computers you hopefully will notice that row 1 and 2 refuse to sort based upon the secondary D column descending however rows 3,4 and 5,6 will sort correctly. Flip it back to "Ascending" for the secondary Sort of column D and it works correctly for 3,4 an 5,6.
Why does Excel refuse to sort rows 1 and 2 correctly based upon the secondary column D?
I am creating an Access database from excel. In the code I get the Database and Tables name from Excel spread sheet and assign them to variables.
In the first table, & tblNamePrime &, I create a Primary Key called, [PrimeRecId]. I create a second table, & tblName & and try to create a Foreign Key called, [RecId] and try to Reference it to the table, & tblNamePrime & [PrimeRecId]. I always receive the following error message:
Syntax Error in CONSTRAINT Clause
-2147217900(80040e14)
If I remove the code in blue it creates the tables but then I need to go th access and link them by access
I have tried many different ways and have followed instructions from SQL, Access VBA and I am unable to Link the Primary Key to the Foreign Key.
I am new at trying to tie Excel to Access and SQL.
The code below is just 2 tables but when I am done there will be a total of 4 tables all linked back to the first table.
Private Sub RDCModel()
Dim dbConnectStr As String
Dim Catalog As Object
Dim cnt As ADODB.Connection
Dim dbPath As String
Dim tblNamePrime As String
Dim tblName As String
'Set database name here
'MsgBox "Current user is " & Application.UserName
dbPath = ActiveSheet.Range("C1").Value 'Database Name.........
Is there a way to Right justify a secondary Y axis?
The primary Y axis is right justified, but the secondary is left justified.
I am trying to add a secondary axis for a graph but it is not displaying as it normally does, instead of the columns remaining side by side they overlap. I don't normally have any issue with this so I'm not sure what I'm doing wrong. I've attached images to show what i mean.
Before I add secondary axis
After adding secondary axis
I know it is possible in Access auto assign a unique ID (primary key?) to each record in a table. I am creating records in a table using Excel and Visual Basic to write to a ".mdb" file without using Access. Is there a way to auto assign a unique ID within the coding?
The reason I ask this is if I had two users writing to the ".mdb" file at the same time, I don't want them to end up with the same ID's for two differend records.
Sub UploadRecord()
Dim DBName, DBLocation, FilePath As String
Dim DBConnection As ADODB.Connection
Dim DBRecordSet As ADODB.Recordset
Dim XLRow As Long, XLColumn As Long
Dim DataRange As Long
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Worksheets("Find Record").Range("A2").Value = Worksheets("Index").Range("H3").Value
Worksheets("Find Record").Range("B2").Value = Worksheets("Index").Range("I3").Value
Worksheets("Find Record").Range("C2").Value = Worksheets("Index").Range("J3").Value
Worksheets("Find Record").Range("D2").Value = Worksheets("Index").Range("K3").Value
Worksheets("Find Record").Range("E2").Value = Worksheets("Index").Range("L3").Value
Worksheets("Find Record").Range("F2").Value = Worksheets("Index").Range("M3").Value
Worksheets("Find Record").Range("G2").Value = Worksheets("Index").Range("N3").Value
Worksheets("Find Record").Activate.........................
I would like to generate a primary key for each line of my spreadsheet. My spreadsheet flows like so: Each row is an individual record. I have a status column that represents the status of each record. Ultimately, thie represents different forms of open status & then of course a closed status. The only other status is blank. When I go from blank status to non-blank I would like to generate a unique # that I can use key that I can it use refer to this unique record.
View 9 Replies View RelatedI have a log that I have data validations on.
Column C validates on a list called "Division"
Column D is supposed to validate based on the selection in Column C, and give the list based on Column C.
I had it working awhile ago, then I went and changed the lists. Now, the lists are not validating appropriately (I'm not getting the expected drop down in D based on the selected in C) and I don't know why its not working anymore.
How do I select all of the series on my chart and flip them over to the secondary axis? I can't seem to find an answer via google... Either VBA or straight Excel would be fine.
For the record, this is part of a larger question. I've been creating a chart using a couple for loops to work through a 2D array (VBA, clearly). At first I would just set each series to the second axis as it was created, but I've found that if I use collapseable groups to turn off different values...well, if I collapse the first series it all dissapears (still shows up in the legend, but the lines are gone.)
If I leave them on the primary axis I have no prolblem. So now I'm working on the theory that it's the way they are being added. So I'm looking for another way to put them on the other axis.
how do you put all series in a graph on the secondary axis all at once. Either an Excel based or VBA answer is fine (I can turn the Excel into a Macro if push comes to shove.)
where i can fix the secondary value axis to start at 0 instead of starting from minimum value like usual?
like the min value of my value axis is -12, the secondary axis will follow suit, i. e 0% will start at -12. i want it to start at 0 instead.
I have a VBA program in Excel that creates an Access Database. There are 4 tables and below are the SQL statements that create the Database. There are more fields associated with each table. When I go to Access the tables look great and I do not get any error messages.
[code] ...
When I send, “write” records from Excel to the tables the record's data is written correctly, the AcountInformation [RecId] updates with an auto number correctly the Primary Key auto number of each of the subsequent tables updates correctly.
The Foreign keys do not contain the record number from the, “refers back to AcountInformation [RecId] Primary Number”. Every thing works except the updating of the Foreign Key
I have tried everything even going into access and manually deleting a record from AcountInformation table to see if it deletes the appropriate records in the other tables and updating a record. It does not update and or delete the records from the other Tables.
The bottom line, Access does not pass a Primary key number to the Foreign Key.
My Excel gets stuck in a strange world sometimes where it seems like a pop-up blocker is turned on. By this I mean that i can't get question alerts to show in Excel. My only relief has been to reboot.
Here's what I mean - I generally see this two different times:
If I'm in a document that I've modified and click the "X" to exit the file - it never asks me to save, just closes without saving.
When I do a "find" on an item, I do get the first box where I can specify my search criteria. If there is a match, it will take me to the match if I do a find next. However, if I do a find all or there is not match, nothing else happens. I can see the cell addresses flickering in the name box.
When ever I add a secondary axis to my chart my bar chart sub type changes to a stacked bar chart. How do I keep the sub type bar chart? I have attached an example. I have tried playing with the gap and width of the bars but to no avail.
View 3 Replies View RelatedI have a stacked column chart that I need to show an average on, that is on a second axis and shown as a line rather than a column.
I have tried moving it to a secondary axis but then it keeps changing the graph to show only the average.
this is just one of about 25 graphs I am having to do like this.
stacked 2 axis.xlsx
I have a document to track funding and would like to be able to auto-populate individual task sheets within the workbook based on a task drop-down. So if I choose Safety from the "Task Area" drop down it would auto populate the full row from the Master Sheet to the Safety Sheet. I have uploaded my document so you can better understand.
Funding Roll-up for 5.1.xlsx
I have this spreadsheet that has over 20,000 rows. I was asked to build a search page to will bring back all transactions based on a primary key (account number). Here is a sample:
Account NumberDateComments2343566/2/2009 $ 111.43 3453465/1/2009 $ 89.34 5676552/5/2008 $ 643.23 8078989/3/2008 $1,245.34 12543612/5/2008 $ 56.65 2343562/2/2009 $ 343.54 3482459/9/2008 $ 78.76 9345641/2/2009 $ 356.22 2343565/3/2008 $ 529.66
The idea is to enter an account number like 234356 click a button and bring back:
Account NumberDateComments2343566/2/2009 $ 111.43 2343562/2/2009 $ 343.54 2343565/3/2008 $ 529.66
I got the button part done and using vlookup it brings back the first line. The problem is that it won't bring back all the rows just the first one.
I have a sheet which I need to arrange and it looks like -
Column A
Column B
Column C
Column D
[Code]...
the values in Column B, C , D , E & F need to be in new columns based on what we have in Column A associated with "1"
Output should be -
Column A
Column B
Column C
[Code]....
so whatever is in Column A associated with "0" should remain in place whereas whatever is in Colimn A associated with "1" should get added to the new columns. 0 and 1 resembles the 1 Records which are used as a split to normalize the data.
All I want to do is color the numbers on both the primary and secondary axis. Primary i want the shade of blue below. Secondary I want the shade of green below. Only the primary axis part of the code does its job. The secondary axis remains black. The code does complete without errors. Excel 2010.
sub color_axis()
ActiveChart.Axes(xlValue).TickLabels.Font.Color = RGB(38, 40, 118)
ActiveChart.Axes(xlSecondary).TickLabels.Font.Color = RGB(0, 153, 0)
end sub
I've put together code to construct a chart
It all works fine but I've noticed an odd quirk which I can't explain nor can I seem to fix. Here's the (reduced) code :
Code:
Dim appExcel As Object ' Excel Application
Dim chtPareto As Object ' Chart
Set appExcel = CreateObject("Excel.Application")
Set chtPareto = appExcel.Charts.Add
With chtPareto
' Primary category axis
[code]....
The category (x) axis title should be horizontal, whereas the value (y) axis title should be rotated. Stepping through the code, when I .SetElement for the category axis title, it appears horizontal as planned. However, as soon as I .SetElement for the rotated value axis title, the category axis title also rotates.
The following code works to update the target sheet based on matching column names within the source sheet.
However, I would like to bolster this by not only updating based on matching field names, but also the primary key in column A. Meaning the data from the source sheet isn't always in the same order (based on primary keys) as the data in the target sheet. So I want to keep the order of the primary key in the first column and then update matching field names in column B through the last column where the primary keys match between the source and target worksheets.
Sub CopyDataBlocks()
'VARIABLE NAME 'DEFINITION
Dim SourceSheet As Worksheet 'The data to be copied is here
[Code]....
I am in the process of making a database more efficient and am running into a problem with sorting data. I currently am trying to use AutoFilter to sort the data. When I want to then narrow the results further using the same column as the critical and there is nothing that matches the critical, I get everything from the entire database that matches that critical rather than what I want to see, which, in this case, would be nothing.
I have attached a sample file. In it, when All AF 1000 is run and then Selected MAC 2000 Wash is run, I want to see no results instead of seeing all MAC 2000 Washes from the original data set. I can do it using IF/THEN but I am looking for a faster way to do it.
I have a userform where I have 2 comboboxes. The first combobox shows the the first column (only 1 of each) and the second comboBox shows me the secondary list that correlates to the valuse in the first from column B. Now I have a text box that I am trying to get the value from column C depending on what I have in the first 2 comboboxes. What is the easiest way to do it? This is all in VB since it is a UserForm, and using Vlookup seems to be too many lines if I go that route. Is there a way to use Index and Match in VB where it would be more efficient? I attached just a sample of how the data would be layed out in the Excel sheet.
View 4 Replies View RelatedI have a table of data (say Column1 to Column 5) with multiple rows.
Column 1 to 4 will have the lookup values in multiple rows and Column 5 data should be picked up using vlookup or other lookup function.
I managed to somehow bring all these lookup values in (Column 1 to 4) in a single column in another sheet. I am now trying to use some lookup or other functions to match this single column and pick column 5 data in original sheet. Result i am expecting is lookup value in first column and next to it column 5 value.
It is basically a lookup wherein lookup value is spread over multiple rows and columns and result column is fixed. I tried using vlookup, but lookup value column and column number had to change every time when i moved from column1 to 4.