ms-access

How to add file name when importing multiple Excel files to one Access table

对着背影说爱祢 提交于 2019-12-24 09:48:27
问题 I am using Access VBA to import multiple Excel files into my Access database. This will be a monthly process with 20-50 files and 10-60K records. I need to include an "Application name" that isn't included within the spreadsheet file itself, but is in its file name. Rather than manually adding the application name to the Excel file I'd like to have it added via my VBA code. I'm not proficient with Access and have pieced most of this together from searches on how to complete. This "works" but

fastest/secure way for export mysql tables into ms Access table

…衆ロ難τιáo~ 提交于 2019-12-24 09:40:07
问题 i'm searching for a way to export some MySql tables into other tables of a MsAccess DB (I'm talking about a million records table...) the only two way that I thought about are: export from myadmin or toad a csv file and then import it into the access DB. making directly from Toad the "Access Database Export" I'm getting that the first is more fast but less secure for the data integrity, while the second is perfect for the data integrity but very slow ... someone knows other ways? Thanks A.

DSN-less connection to mysql server in ms-access not remembering user name and password

北战南征 提交于 2019-12-24 09:39:45
问题 For ease of distribution I want all the mysql linked tables to be DSN-less. I also want to be able to relink the tables to a different server easily (for test purposes), so I'm doing the link setup in vba code. This is the code I use to setup/refresh any links: Private Sub relink_mysql_tables(mysql_connection As String) Dim db As Database Set db = CurrentDb() Dim tbldef As TableDef For Each tbldef In db.TableDefs If (tbldef.Attributes And TableDefAttributeEnum.dbAttachedODBC) Then tbldef

Form is ignoring the code in OnOpen event

▼魔方 西西 提交于 2019-12-24 09:39:39
问题 Have a new form that contains controls and is linked to a table in SQL Server. Have code that relinks the table on open, and that code works in 5 other apps, but not this one. Here is the code: Dim tdf As DAO.TableDef For Each tdf In CurrentDb.TableDefs ' check if table is a linked table If Len(tdf.Connect) > 0 Then tdf.Connect = "Connect String" tdf.RefreshLink End If Next I had the form set up in options to open when the app is activated, but it ask for the password which I have in the

MS Access DB doesnt save changes after execution (C#)

岁酱吖の 提交于 2019-12-24 09:39:25
问题 I have the following code for using an access database OleDbConnection con = new OleDbConnection(myproject.Properties.Settings.Default.myDBConnectionString); con.Open(); OleDbCommand command = new OleDbCommand("INSERT INTO components (name) VALUES (@p_col1)", con); command.Parameters.Add("@p_col1", OleDbType.VarChar).Value = "test row"; int rows = command.ExecuteNonQuery(); At this point rows value is 1 and when I make select queries after that the row inserted is available. The problem comes

Optimize access query with nested IIF's

霸气de小男生 提交于 2019-12-24 09:39:16
问题 Is there a better way to write the following in my where clause? WHERE (IIf([GrpOrder]=3,IIf([LabelText]="Totals",True,False),True)) =True)) Thanks, Scott 回答1: I assume your code contains typos (unblanaced parentheses) and should in fact read: WHERE IIf([GrpOrder]=3,IIf([LabelText]="Totals",True,False),True) = true From a SQL code perspective there are actually nine cases to consider because of SQL's three value logic with NULL : GrpOrder = 3 GrpOrder <> 3 GrpOrder IS NULL LabelText = 'Totals

VBA code that changes the background color of a form after update

拈花ヽ惹草 提交于 2019-12-24 09:38:42
问题 I need some code that when a check box is unchecked it will change the background color of my form and return it back to its original color when checked. The code i have for the check box currently locks a combo box when a value is chosen. Example below Private Sub AccessKeyNo_AfterUpdate() If MsgBox("Do you want to assign Access Key " & Me.AccessKeyNo & "?", _ vbYesNo) = vbYes Then Me.GuestAccessKeyID = Me.AccessKeyNo If Me.Dirty Then Me.Dirty = False Me.AccessKeyNo.Requery Me.AccessKeyNo =

How to find count of multiple records with different where conditions from same table with multivalued fields

余生长醉 提交于 2019-12-24 09:34:51
问题 I asked a question earlier today but I have a follow up question to that which adds a complexity of multivalued fields. Given a following table: ID lightness | darkness | color ------|-------------|--------------|--------- 1 |10 | 20 | green, blue, yellow 2 |10 | 08 | green, purple, orange 3 |10 | 10 | black, magenta, orange 4 |20 | 05 | green, creame 5 |10 | 20 | red, purple 6 |10 | 16 | red, white 7 |33 | 20 | brown, red 8 |10 | 10 | green, blue I want to find out: Count of records where

Expression from one query being pulled into subsequent query

人走茶凉 提交于 2019-12-24 09:18:52
问题 I have a the following tables "Base" and "Join": Base: ID Field A 1 B 2 D Join: ID A B C D I use the following select query "ExampleQuery" to parse "Base": SELECT Base.ID, IIf(IsNull([Field]),"None",[Field]) AS Newfield FROM Base; And the following select query to left-join table "Join" to query "ExampleQuery": SELECT Join.ID, ExampleQuery.Newfield FROM [Join] LEFT JOIN ExampleQuery ON Join.ID = ExampleQuery.ID; My output is the following: ID Newfield A 1 B 2 C None D None I am expecting the