Quantcast
Channel: Access for Developers forum
Viewing all 14673 articles
Browse latest View live

How To Import Into A Table with Multi-Value Fields

$
0
0

Hello:

I have a table with a multi-value field that contains states in which a company does business.  It is multi-value because there can be more than one state.  I tried to import a text tab-delimited file in which the data was arranged as follows:

Field1 Tab Field 2 Tab OR, WA, CA Tab

The "State field contained the multiple entries separated by a comma (like they appear in a query of the multi-value field), but it won't accept it.  Does anyone know how to import into a multi-value field?

Thanks,

Rich Locus, Logicwurks, LLC

 


VB.net Microsoft.Office.Interop.Access.Application with a workgroup file (system database). Bypass username and password log in window!

$
0
0

I am super stuck here.  I have a vb.net program that successfully opens an Access report and exports it to a PDF.  It's a windows form app and the database is protected by a workgroup file (MDW). When I call

accObj.OpenCurrentDatabase(sDevServPath, False)

The Logon window appears and asks for the username and password. This was a bit annoying because I wanted it to be fully automated, but I'm always at the computer when it runs and just entered them manually. However, now I want to run this report in a console app that will get triggered in the middle of the night by a scheduled task. I won't be there to enter the username and password. Here's the code that works in my Windows Form app.  I get prompted for the UN and PW at OpenCurrentDatabase

        accObj = New Microsoft.Office.Interop.Access.Application
        accObj.SetDefaultWorkgroupFile(Path:=PathToMyMDW_File)
        accObj.OpenCurrentDatabase(sDevServPath, False)

        Dim sWC As String = "filenum = '" & sFileNum & "'"

        'Open the report in preview mode using a WhereCondition: 
                accObj.DoCmd.OpenReport(ReportName:="rCaseReview", _
                    View:=Microsoft.Office.Interop.Access.AcView.acViewPreview, _
                    WhereCondition:=sWC)

I have tried:

 accObj.DBEngine.DefaultUser = sUn
 accObj.DBEngine.DefaultPassword = sPW


But it prompts me for the UN and PW when that first line runs.

I've also tried

 Threading.Thread.Sleep(5000)
 My.Computer.Keyboard.SendKeys(sPW & "{Enter}")

It doesn't want to work. Please help!

Please help!



Updating via subform

$
0
0

I have a Customer Form which has two subforms - Salesperson and Division. It follows the structure:

Customer Table

ID

CustomerName

SalespersonID

DivisionID

Salesperson Table

ID

Initials

FirstName

LastName

Division Table

ID

DivisionNumber

DivisionName

I have a Customer Form that has two subforms, one with the salesperson data that is linked to the salespersonId in customer table and one subform with division data that is linked to the divisionid in customer table

Since the subforms can only have one record, I'd like to have a dropdown in the subform where the user can change the salesperson or division for a customer in the subform.  For the subforms, I use the link child/master fields.

How do I set a field with a dropdown that changes the ID in the customer field?

Thank you for your help

Query Advise

$
0
0

Hi

I have tables as below at the end. They are related like so; 

Staff --> StaffBookings <-- Events <-- Venues

How can I find below;

Staff who have been booked for a given venue for 12 consecutive weeks even if they worked only one day in any given week?

Thanks

Regards

===========================

Events
[ID] 
[EventDate]
[VenueID] 

Staff
[ID] 
[Forenames] 
[Surname] 

StaffBookings
[ID] 
[StaffID]
[EventID]

Venue
[ID] 
[Venue]


VBA to update SQL in all db queries

$
0
0

Hi All,

I'm looking to generate a simple procedure in access that would iterate through all queries search for a specific piece in the script and replace it according to the procedure. This would specifically relate to replacing the output location of make table queries.

Eg if "xy" is found in the script replace it with "zw".

I'm rather new to using vba, so thank you for helping a rookie out.

Wrong date format in an Access frontend - SQL Backend context

$
0
0

Hello everyone !

So i'll try to be as clear as possible concerning my issue.

Recently I was asked to transform an Access Backend into a SQL Backend. The Frontend already was an Access DB, and the goal of this manipulation was to transfer the backend onto an SQL server, and to link the tables of this new SQL backend with the access frontend.

After many problems I finally achieved in migrating the DB on my SQL server, only to find that the date format was changed during the migration. In SQL the date format is yyyy/mm/dd and on my Access backend and frontend the date format is mm/dd/yyyy.

But as the queries of the frontend were abble to grab the same dates (but in different format) I thought it was okay.

And here comes my issue: when I try to insert a date into the SQL backend using the Access frontend, I get an error that says "Conversion failed when converting date and/or time from character string".

And so I guess that when I try to insert a date into the SQL backend using the Access frontend, the format isn't converted and it results in an out-of range value. I thought of changing the format of the dates on the Access frontend, but I wasn't abble to do so as the tables are linked to an external database and are impossible to modify.

So if anyone has an idea I would gladly try it as I ran out of ideas !

Thanks !

Best regards

Access front - SQL back wrong date format issue

$
0
0

Hello everyone !

So i'll try to be as clear as possible concerning my issue.

Recently I was asked to transform an Access Backend into a SQL Backend. The Frontend already was an Access DB, and the goal of this manipulation was to transfer the backend onto an SQL server, and to link the tables of this new SQL backend with the access frontend.

After many problems I finally achieved in migrating the DB on my SQL server, only to find that the date format was changed during the migration. In SQL the date format is yyyy/mm/dd and on my Access backend and frontend the date format is mm/dd/yyyy.

But as the queries of the frontend were abble to grab the same dates (but in different format) I thought it was okay.

And here comes my issue: when I try to insert a date into the SQL backend using the Access frontend, I get an error that says "Conversion failed when converting date and/or time from character string".

And so I guess that when I try to insert a date into the SQL backend using the Access frontend, the format isn't converted and it results in an out-of range value. I thought of changing the format of the dates on the Access frontend, but I wasn't abble to do so as the tables are linked to an external database and are impossible to modify.

So if anyone has an idea I would gladly try it as I ran out of ideas !

Thanks !

Best regards


Can't delete new record in MS Access

$
0
0
Hi guys, I've recently just linked MS SQL Express with MS Access. So, everything works just fine when I add a new record. However, when I try to delete a newly inserted record I get the message "The Microsoft Access database engine stopped the process because you and another user are attempting to change the same data at the same time.". I'm not quite sure what might be the cause of this since I'm the only person who uses the database. Appreciate all the helps in advance guys.

Refreshlink AWS

$
0
0

I have an Access table that is linked to a AWS table. I didn't set this up, the consultant who did is gone. I need to Refreshlink the table on a Form load. I can run the code below to RefreeshLink on my P.C. but it doesn't work on the Access table that is linked thru the AWS table. It might be because AWS isn't done thru a DAO connection(Sharepoint)? In Linked Table Manager the Data Source Name is Sharepoint and the Data Source Information is Https://......

This is the code I used.

Dim db2 As DAO.Database
Set db2 = CurrentDb

Dim tdf1 As DAO.TableDef
Set tdf1 = db2.TableDefs("AccessLinkedTable")
tdf1.RefreshLink

ACCDE won't run any VBA

$
0
0

I have an Access 2010 accdb that works quite well. It runs VBA on opening via an autoexec macro and the form it opens to has simple code that checks the current username to determine permission levels and changes a date selector box based on radio buttons.

Normally I export this to an accde file and save it on a network location so users can use the database without changing things hard coded in the VBA such as key users with elevated permissions.

However last time I exported I found that no code ran at all. The file is in a trusted location.

I found a few forum posts already and followed the instructions there. I found a do-all-end-all instruction set and followed it which is as follows:

1) I checked the references to make sure none were missing

2) I compacted and repaired

3) Decompiled the VBA

4) Compacted and Repaired

5) Recompiled the VBA

6) Compacted and Repaired

7) Reexported accde

This didn't solve the problem.


Setting Bi-Monthly Dates based on current date

$
0
0

I have a report that needs to run bi-monthly and I'd like to default the start and end date based on todays date.

If todays date is between the 1st and the 15th, then the start and end date need to be the previous months 16th-last day of month.

if todays date is between the 16th and last day of month, start and end date need to be 1st-15th of that month.

Is there a graceful way to handle last day of month and having to go back a previous year?

Thank you

Creating Queries to Modify Data into a Plottable Form

$
0
0

I've broken this post into 3 parts due to character limit.

Hello,

I’m trying to figure out how to organize data from lab results so that the table relationships are in 3NF, and from that create a query(ies) allowing for the relative difference (RD) and running average RD for each sample between instruments for the home lab and the off-site labs to be plotted. Specifically, I’m having trouble creating the queries for steps 2, 3, and 8, but I’ll show the entire process in case anyone has a better suggestion on how to get the data from the start to the end.

Note: I’m sure someone will ask about this, so I’ll explain this now. Currently, lab procedure is to run each sample twice, but there is no guarantee that won’t change in the future. Because of that, I can’t simply have 4 column for each run for each sample because it may be 2 runs at the off-site lab and 1 run at the home lab, 3 runs at both labs, etc. which will ruin 3NF. As such, each run has its own entry record.  This way if in the future we change the number of runs done for each sample the database will still be in 3NF.

As an example scenario, let’s say I wanted to compare the RD and the running average RD between instrument 1 and the instruments used at the home lab. Here is an example of a query from different tables which has all the relevant data which I start off with for this process:

Run ID

Date

Lab Name

Instrument ID

Sample ID

Run Time (sec)

1

11/6/19 10:05:00 AM

A

1

101

500

2

11/6/19 10:05:00 AM

A

1

101

520

3

11/7/19 12:00:00 PM

A

2

102

350

4

11/7/02 12:00:00 PM

A

2

102

380

5

11/7/19 1:00:00 PM

B

3

103

395

6

11/7/19 1:00:00 PM

B

3

103

392

7

11/11/19 2:00:00 PM

Home

4

102

375

8

11/11/19 2:00:00 PM

Home

4

102

345

9

11/11/19 2:10:00 PM

Home

5

101

440

10

11/11/19 2:10:00 PM

Home

5

101

450

11

11/11/19 2:20:00 PM

Home

4

103

400

12

11/11/19 2:20:00 PM

Home

4

103

400

13

11/12/19 2:00:00 PM

A

2

211

343

14

11/12/19 2:00:00 PM

A

2

211

343

15

11/12/19 3:00:00 PM

B

3

205

535

16

11/12/19 3:00:00 PM

B

3

205

560

17

11/14/19 9:00:00 AM

A

1

214

295

18

11/14/19 9:00:00 AM

A

1

214

310

19

11/18/19 1:50:00 PM

Home

5

205

540

20

11/18/19 1:50:00 PM

Home

5

205

542

21

11/18/19 1:55:00 PM

A

1

330

425

22

11/18/19 1:55:00 PM

A

1

330

520

23

11/18/19 2:00:00 PM

Home

4

214

315

24

11/18/19 2:00:00 PM

Home

4

214

320

25

11/18/19 2:10:00 PM

Home

5

211

360

26

11/18/19 2:10:00 PM

Home

5

211

350

What I want to end up with is this, which will allow me to plot RD or Running Average RD vs sample ID is this:

Run ID

Date

Lab Name

Instrument ID

Sample ID

RD

Running Average RD

1

11/6/19 10:05:00 AM

A

1

101

14.61%

14.61%

17

11/14/19 9:00:00 AM

A

1

214

-4.72%

4.94%

Here are the steps I’ve figured out so far.


Downloading Runtime question

$
0
0

When they ask you to make a choice from these 2 downloads is this the Access 32 or 64 bit, or the operating System

Thanks for any help..........Bob

 
File Name:

AccessRuntime_x64_en-us.exe

AccessRuntime_x86_en-us.exe

Date Published:

22/04/2014

File Size:

284.6 MB

212.3 MB


xxx


Macro to execute Linked Table Manager -> Refresh

$
0
0

Is There anyway to make a macro (like Excel) to mimic the key strokes to bring up the "Linked Table Manager" to "Select" to "Refresh" option in Access?

Thx in advance.

ODBC Timeout property doesn't impact how long it takes for a query to timeout

$
0
0

Per docs and postings the ODBC Timeout property is supposed to define the number of seconds before an query's odbc connection attempt is ended. But I've experimented and find that it has no impact whatsoever. If I set the property to 2 seconds it still takes anything from 21 to 40 seconds for the sql server Connection failed dialog appears.

All I can think of is that my testing methodology is wrong. I am interested in controlling how to control the number of seconds before the query gives up when a sql server database is not available on the network. To test, I take the sql server offline. I'm wondering if the odbc timeout property is only meant to deal with the timeout value for queries that can actually be invoked?

If that's the case, is there a way to test to see if a sql server is available before attempting to run a query?


ODBC reset on Windows 10 PRO

$
0
0

The server PC OS is Windows 10 PRO and the client PC OS is Windows 10 PRO.

Currently, 32-bit ODBC Microsoft Access Driver (*.mdb) driver is used to share mdb files on the server PC.

After rebooting, the ODBC drive path is cleared and you need to configure ODBC again.

Is this associated with entering the login password at boot time?


I've tried it like this: Is there no solution?

Thank you for visiting the Windows program site.

We'll answer your reset with ODBC.

One of the possible causes of this problem is that the profile is initialized by an additional application process.

To solve this problem, you can work with the command msconfig.
• Uncheck Hide all services after starting Microsoft services.
• Uncheck Windows or Microsoft related programs from startup programs.


Checking for consecutive values

$
0
0

Hi

I have a table of StaffIDs and WeekNumbers; for weeks of year that a staff has worked.

How can I get a list staff who have 12 consecutive week numbers, to show they have worked consistently for 12 weeks? 

Thanks

Regards



Access Close Button in Access 2013

$
0
0

Hello All.

The record for a form has been saved.

The form is opened and the record is reviewed.

The form is closed with the Close button on the form.

On the close event of the form, a function that resides in Modules is called to check the record to see if it has been saved.

If the record has not been saved then another function that resides in the form is called to save the record.

If the record has been saved then the save routine is not called.

In this case no attempt is made to save the record and the form closes.


The same form with the saved record is opened again.  This time the form is closed with the Access Close Button (the red X at the top upper right of the window).

An error is thrown from the save routine that says the record cannot be saved.

Why does the program ignore the results of the function that resides in Modules that checks the record to see if it has been saved in this instance?

Thanks.

https://army-vsnavy.com/2019-live/

$
0
0
https://army-vsnavy.com/
https://army-vsnavy.com/2019/
https://army-vsnavy.com/2019-live/

output to action was cancelled

$
0
0

I have recently started getting the "output to action was cancelled" error frequently, but not consistently with my code.

The module generates Access reports as a pdf file in dropbox.  I've used the exact same module for a couple of years and have never gotten this error, now I get it several times per day.    The odd thing is that I can run the same module multiple times and it will work sometimes and not others.

A sample of the code is below

 ' Elder Care
    If Dir(DROPBOXPATH & "schedules\elder.pdf") <> "" Then
        Kill DROPBOXPATH & "schedules\elder.pdf"
    End If
    DoCmd.OutputTo acOutputReport, "Fax Schedule - 2018 - Elder", "PDFFormat(*.pdf)", DROPBOXPATH & "Schedules\elder.pdf", False, "", 0, acExportQualityPrint
    ' Community
     If Dir(DROPBOXPATH & "schedules\community.pdf") <> "" Then
        Kill DROPBOXPATH & "schedules\community.pdf"
    End If
    DoCmd.OutputTo acOutputReport, "Fax Schedule - 2018 - Community", "PDFFormat(*.pdf)", DROPBOXPATH & "Schedules\community.pdf", False, "", 0, acExportQualityPrint

I added the code to check for the file and delete it if it exists in case there was an issue with it overwriting the existing file, but that didn't solve the problem.    Any other ideas?

Viewing all 14673 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>