User Profile
Collapse
-
In VBA it's DoCmd.SetWarnin gs False. -
I may be wrong, but I believe that in order for your code to work you need to add a reference to the Microsoft Scripting Runtime. To do this go to your VBA editor and then Tools, References, scroll down until you see this choice and click the box next to it. I know that in order to access File System Objects you need this reference added and I suspect that maybe this reference isn't added in. If it is I apologize, but I figured I'd throw this out...Leave a comment:
-
No need to apologize. Thank you for that bit of information I'll be sure to keep that in mind as I continue to work with Access.Leave a comment:
-
Returning a Value from a Select Query
I'm using Access 03 on Windows XP Pro.
I have a section of code that is creating an excel spreadsheet. In the first column I need to put a unique value corresponding to a given location that is given by an autonumber in one of the tables. I know that you can't use DoCmd.RunSQL to run a Select query, as it isn't considered an action query. Is there another way to go about finding this value from the table and storing it so that it... -
Please excuse my ignorance, but why would long vs. integer make a difference because when the field is added to the table they both get put in as a number. I'm just curious for future reference.Leave a comment:
-
I tried that and it didn't work. Same syntax error. I tried multiple other variations and the same error continuously popped up so I decided to radically change how I was approaching it and I came up with a solution. I switched to ADO and the same syntax worked fine. To follow is the code I used.
...Code:Private Sub Create_Table_Click() Dim SQL As String Dim tblName As String Dim cmd As New ADODB.Command
Leave a comment:
-
UPDATE: I also tried the following thing as well, but it also didn't work:
The error it gives me is the following:Code:SQL = "ALTER TABLE [Test Table] add CONSTRAINT fk_ID Foreign Key(ID) References [Key Metrics](ID) ON DELETE CASCADE;"
Run-time error '3289': Syntax error in CONSTRAINT clause.
I tried just putting it into the query editor instead of VBA and it gives the same error and then...Leave a comment:
-
SQL Code to Set Desired Relationship
Hello all! First thank you to everyone in this community that has been helping me over the past few days. It's greatly appreciated and I've learned a lot. At the moment I'm trying to write some SQL code to set up the proper relationship between a created table and an existing table. The existing table is called key metrics and it has an autonumber primary key ID. The created table has a field also called ID, which is a number...NOT an autonumber,... -
Excellent. That did the trick and I got everything to work. Thank you very much!Leave a comment:
-
-
Yes! That sounds like exactly what I'm looking for. Would it then be possible to have this set of precedures generate some SQL code that would have its results opened in Excel?Leave a comment:
-
Generating SQL on the Fly
Hello all,
First, I'd like to thank everyone that helped me with my last problem. It was greatly appreciated. What I'm trying to do is generate SQL on the fly so that a report can be generated and exported to Excel based on selections made by the user. For example, they'll select a date range, a location and what they want to sort the data by. Can anyone point me in the right direction as to how to do this? Thank you in advance for... -
Hey Brad,
I just wanted to let you know I ended up figuring it out and wanted to thank you for your help and guidance. The way I did it was using a DoCmd to import the spreadsheet directly to a query which split the information up. Thank you again for all your help.Leave a comment:
-
Here is the code that I've made so far which succesfully imports the files. Special thanks to members ont his network that have helped me fix some quirks in this code in the last discussion I made:
...Code:Private Sub Done_Click() Dim File As String Dim LastDataColumn As String, LastDataRow As String Dim LastDataCell As String 'Set File name File = "C:\Sample Data.xls"
Leave a comment:
-
Primary Key Issues
Hello all,
I previously posted under this heading: Importing Data from One Excel Sheet into Multiple Access Tables Simultaneously, but the nature of the problem has changed so I decided to make a new discussion. Thanks to one of the members here I was able to successfully import the data into the tables from the excel spreadsheet and I greatly appreciate his help. However, I've run into a new problem. The first table assigns the unique... -
Brad,
Thanks for that bit of code. That definitely helped. However, it led me to another problem. The ID is set by an autonumber in the first table things are copied into. However, this ID needs to be duplicated in all the other tables. The reason for this is because users run reports that pull information together from the various tables in stages, so access needs to know what entries go with what entries in each table. I can't find...Leave a comment:
-
rewalk started a topic Importing Data from One Excel Sheet into Multiple Access Tables Simultaneouslyin AccessImporting Data from One Excel Sheet into Multiple Access Tables Simultaneously
Hello all,
I've set up protected Excel sheets that users can paste data into. I then need to be able to pull the data they paste into multiple access tables and then reset the Excel spreadsheet back to the template. For example, the first few columns go to the first table, the next 3 into a second table and so on. Is this possible? I can't think of a way to do it. Thanks in advance for all your help!
No activity results to display
Show More
Leave a comment: