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

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?


Access - Crosstab query and Append query

$
0
0

Hi,

I'm adding a crosstab query to already existing Append query, when I run the table is not populating the data.

I want the A1 field data and the rest of the fields populated as circled in the screenshot. If the remove the crosstab query the data is populating, but I want the data that's in the crosstab query

Please help!

VBA doesn't work in accde but does in accdb

$
0
0
Greetings,  I have vba code that works in my accdb but does not work in my accde.  I have: 

1. compacted and repaired

2. decompiled

3. created a whole new db and imported all the objects, compiled to same area, and tried to run

The accde will not perform the vba that is in the accdb.

How to use Database Compare on 64-bit O365 ProPlus?

$
0
0

After getting all the prerequisites out of the way I finally got Database Compare to run. Only to have it throw another exception later:

ERROR:Unable to cast COM object of type Microsoft.Office.Interop.Access.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Access._Application’”this operation failed because the QueryInterface call on the com component for interface with IID '' failed due to the followinf error:Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

Research on this error suggests that it could be due to bitness mismatch somewhere. Everything on my system is 64-bit so now I'm wondering if the problem is that Database Compare itself is 32-bit and can't talk to my 64-bit database.

Can anyone help me get past this error and get on with comparing files?

SYSTEM DETAILS:

OS: Windows 10 Pro 1909 18363.535 64-bit
OFFICE: O365 ProPlus Version 1902 64-bit
ACCESS: 16.0.11328.20492 64-bit

Select field with highest date

$
0
0

Hi,

I have a table A with an ID and a comment field. This table is in relation with table B with an id and a date field and a comment field.



I want to make a query with A.field1 and B.field1 where B.Field1 has the highest F_date

SELECT A.Field1, Max(B.F_Date) AS F_Date, First(B.Field1) AS Field1
FROM A INNER JOIN B ON A.ID = B.id
GROUP BY A.Field1
ORDER BY A.Field1, Max(B.F_Date) DESC; 

is not OK

Passing variables to Report RecordSource...

$
0
0

I have a report that I want to run based on selection from a form.  I have written a query that has two parameters (date and type) works fine.  How can I invoke the report and pass the variable data to the recordsource?

Thank you!


Thanks for your help!!

How to use SSMA for Access on O365 ProPlus?

$
0
0

In the latest version of Access for O365 ProPlus there is no SQL Upsizing Wizard tool. I have read that this method was deprecated in favor of Microsoft SQL Server Migration Assistant (SSMA). I am here to report that it is impossible to install this tool when running the latest version of O365 ProPlus.

When the installer for SSMA is run it complains that it cannot find the DAO libraries that it needs, despite Access being installed. There is a download button there to save you! That links you to the Access Runtime for 2016. Unfortunately, the Access Runtime installer clearly states that it won't run because O365 ProPlus is installed. Full bork.

Is there a way I can continue to use SSMA for Access in the future?

Is there a different tool I should be using for exporting Access tables to SQL?

I captured the whole debacle in one screenshot:

SSMA need DAO, DAO can't install

SYSTEM DETAILS:

OS: Windows 10 Pro 1909 18363.535 64-bit
OFFICE: O365 ProPlus Version 1902 64-bit
ACCESS: 16.0.11328.20492 64-bit

Add field to Split Form Datasheet

$
0
0
I have a Split form with controls on top and Datasheet(from a single Table) at the bottom. I now have to add a field from a different table. I think I can make it a read-only field not sure. But how do I get this field into the Datasheet now?

Move datasheet to top of subform

$
0
0

Hello,

We have a main form (frmVendorProcessingDetail) and a subform in datasheet view (fsubVendorProcessingDetail). We have a text box on the main form to accept barcodes (txtBarCode). If that field has the focus and you scan a barcode, you will go to the first record on the subform that matches that barcode. The subform shows 15 rows, but an order may have hundreds of items. So far, so good.

The problem is when you have maybe 10 orders for the same barcode. If you have a very large order, and are working in the middle of the recordset, and scan a new barcode, the new record (first) will be at the bottom of the subform (hiding 9 out of the 10 orders). What I would like to do is have my code move the records to the top of the subform (there may be many records above and below). So just the relative position is moved so that it is easier to see all the records associated with that barcode. So right after the “SetFocus” we would like to move that line to the top of the subform.

Image 1 shows the barcode being entered (bottom of main form).

Image 2 shows the results where the found line is at the bottom.

Image 3 shows where we would like the line to be.

Here is some (simplified) code for the barcode field:

Private Sub txtBarcode_AfterUpdate()
On Error GoTo eh
    Dim rs As DAO.Recordset
    Dim cWhere As String

    cWhere = "(tblInventory.UPC = '" & Me.txtBarCode & "' OR tblInventory.ISBN13 = '" & Me.txtBarCode & "' OR tblInventory.ISMN = 'M" & Right(Me.txtBarCode, 9) & "') AND tblVendorOrderItems.QuantityRecieved = 0"
    rs.FindFirst cWhere

    Me.fsubVendorProcessingDetail.Form.Bookmark = rs.Bookmark
     Forms.frmVendorProcessingDetail.fsubVendorProcessingDetail.Form.Received.SetFocus
        Me.fsubVendorProcessingDetail.SetFocus
    
End Sub


Albert S

Reserve error(-5012) there is no message for this error

$
0
0
I cannot open Access database (stored on SharePoint) and keep getting this error. Two workstations, which have new users, cannot access the Access file. I truly need help with this issue. Microsoft Support has been no help. They tried a number of things to no avail. Not only has this affected the new user downtime, but it's affected my downtime, having to spend time on phone with Microsoft. I am ready to change platforms!

Lookup Ideas

$
0
0

I have been asked to develop a database for a non profit organization.  They recently had about 2000 music CD's donated.  They want a application that will catalog them and allow them to check them out to members.  I can do it, but need a suggestion.  So far, I have written the part that allows them to scan the upc code into the database.  That was easy!  Of course can also build and follow a hyperlink that takes them to a lookup page for that CD.  Now they would probably be happy to copy and paste the desired information such as Title and artist, but that will be very time consuming.

I am wondering if anyone knows a method to bulk lookup this information and get the data back in a format that would be relatively easy to import into a access table?  I have found a site that performs bulk lookup of UPC codes, but they charge and this is a non profit organization, they don't want to pay.  Any ideas?

CurrentDb.TableDefs("[Table 1]").RefreshLink stopped working?

$
0
0

I am trying to refreshlink some Access table from Sharepoint. The above code worked fine many times, then all of a sudden stopped working.

Any advice on why it stopped and what kind of error correcting code could be used?

Send data to customer display via RS232 is almost working

$
0
0

Hi everyone,

I have a test form with 2 buttons named "First" and "Second" below are the code I have put, but I try to clear the display by sending a print command but it does not work, I am sure someone will know what I have to do :)

Thanks

Claude from Quebec, Canada

Private Sub First_Click()
Open "COM3" For Output As #1
Print #1, Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20);
Close #1
Open "COM3" For Output As #1
Print #1, Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20);
Print #1, "Lise"
Close #1
Open "COM3" For Output As #1
Print #1, Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20);
Print #1, "Laframboise"
Close #1

End Sub

Private Sub Second_Click()
Open "COM3" For Output As #1
Print #1, Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20); Chr$(20);
Close #1
Open "COM3" For Output As #2
Print #2, "Claude"
Close #2
Open "COM3" For Output As #3
Print #3, "Larocque"
Close #3

End Sub

Disable Form Navigation Buttons But Show Record Count

$
0
0

Hello:

I created special navigation buttons on a form for "Previous Record", "Next Record", "New Record" and "Delete Record".

I need those buttons so I could do special processing for new records.

To avoid confusions, I turned off the standard navigation buttons at the bottom of the form, which don't do any special processing. (I set the form's "Navigation Buttons" property to "No").

However, I would like to see where I am in the table:  Record 5 of 50, etc.

Can I add code to show the record number and total records, or can I modify the standard behavior of the built-in navigation buttons at the bottom of the form and turn back on the Navigation Buttons property?

What is the best way to deal with this?

Thanks,


Rich Locus, Logicwurks, LLC

http://www.logicwurks.com

Site glitch

$
0
0

For info...

There appears to be a glitch with the statistics for the Access forum


Trying to apply a conditional yes/no field

$
0
0
Hi 'm trying to apply a conditional Yes/No Field that would put into operation another field. I have no idea how to do it. Is there anybody out there who may help me, Please?

Windows API SetWindowPos or MoveWindow Not Working

$
0
0

Hi All,

I am trying to do what I thought was just a simple resize of an Access application window to a form. To test this I tried the SetWindowPos and MoveWindow with just some random values that I know would work to resize the window. However, neither API function is working.

SetWindowPos doesn't do anything at all, and MoveWindow sets the Left to 32676, Top to 326627, Width to 32767, and Height to 33867. At this point the application window disappears and I can't get it back without restarting Access.

Below is my code. I am new to the Windows API thing, so I apologize in advance if it is some dumb rookie mistake. This is on Access 2016.

Below are my declarations:

#If VBA7 Then Public Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As LongPtr) As Long Public Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As LongPtr) As LongPtr Public Declare PtrSafe Function GetDeviceCaps Lib "gdi32" (ByVal hDC As LongPtr, ByVal nIndex As Long) As Long Public Declare PtrSafe Function ReleaseDC Lib "user32" (ByVal hWnd As LongPtr, ByVal hDC As LongPtr) As Long Public Declare PtrSafe Function GetWindowRect Lib "user32" (ByVal hWnd As LongPtr, ByRef lpRect As RECT) As Long Public Declare PtrSafe Function MoveWindow Lib "user32" (ByVal hWnd As LongPtr, X As Long, Y As Long, nWidth As Long, nHeight As Long, bRepaint As Boolean) As Boolean Public Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hWnd As LongPtr, hWndInsertAfter As LongPtr, X As Long, Y As Long, cx As Long, cy As Long, uFlags As Long) As Boolean #Else Public Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long Public Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long Public Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long Public Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, ByRef lpRect As RECT) As Long Public Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, X As Long, Y As Long, nWidth As Long, nHeight As Long, bRepaint As Boolean) As Boolean Public Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, hWndInsertAfter As Long, X As Long, Y As Long, cx As Long, cy As Long, uFlags As Long) As Boolean #End If

Public Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

And below is my simple test code that doesn't work

Public Sub SizeAppWindow()

Dim newAppWindow As RECT
Dim appHandle As Long

appHandle = Application.hWndAccessApp

MoveWindow appHandle, 0, 0, 800, 600, 1

'SetWindowPos appHandle, 0, 0, 0, 700, 1000, 0

Application.RefreshDatabaseWindow

WindowsAPICode.GetWindowRect appHandle, newAppWindow

Debug.Print newAppWindow.Left & " " & newAppWindow.Right & " " & newAppWindow.Top & " " & newAppWindow.Bottom

End Sub

The GetWindowRect in the immediate window prints the following

With SetWindowPos:

0  1920  0  1050 (just my monitor size since Access window is maximized)

With MoveWindow:

32767  36627  32767  33867

Any ideas?


Emaling and Priniting from Report View

$
0
0

I have a report that I open in acViewReport so that the user can see in continuous view the header, detail and footer scrolling down. They want the view to scroll down and then be able to click Print or email and it will either:

DoCmd.OpenReport "rpt_ViewAll", acViewReport, , "ID = " & Me.Recordset.Fields("ID"), acDialog

  • Print the report
  • Email that different report

With the Print button,

DoCmd.OpenReport "rpt_View_All", , , "ID = " & Me.Recordset.Fields("ID")

I get an error "This feature is only available in an ADP

And with the Email Button, it opens the email client allows to print, but then locks access and cant get back into access

 DoCmd.OpenReport strReportName, acViewPreview, , strwhere, acHidden
    Reports(strReportName).Caption = strAttachmentName
   
    DoCmd.SendObject acSendReport, strReportName, acFormatPDF, strEmail, , , strSubject

Can I use command buttons in acViewReport or should I use a continuous form instead? and if I use a form, how do I get it so the header scrolls with the detail?

Emaling and Printing from Report View

$
0
0

I have a report that I open in acViewReport so that the user can see in continuous view the header, detail and footer scrolling down. They want the view to scroll down and then be able to click Print or email and it will either:

DoCmd.OpenReport "rpt_ViewAll", acViewReport, , "ID = " & Me.Recordset.Fields("ID"), acDialog

  • Print the report
  • Email that different report

With the Print button,

DoCmd.OpenReport "rpt_View_All", , , "ID = " & Me.Recordset.Fields("ID")

I get an error "This feature is only available in an ADP

And with the Email Button, it opens the email client allows to print, but then locks access and cant get back into access

 DoCmd.OpenReport strReportName, acViewPreview, , strwhere, acHidden
    Reports(strReportName).Caption = strAttachmentName
   
    DoCmd.SendObject acSendReport, strReportName, acFormatPDF, strEmail, , , strSubject

Can I use command buttons in acViewReport or should I use a continuous form instead? and if I use a form, how do I get it so the header scrolls with the detail?


MsAccess error 3046: "could not save; currently locked by another user"

$
0
0
The last couple of weeks (since the 6th of december, 2019) we get this error. 
We work with a MsAccess application in a multiple user environment (split database).
The program (frontend) did not not change. Also the server where the backend resides did not change and the way of working with the application did not change either. And now every day this message pops up and the proces stops.
I am sure there is no one else blocking the work to be done and every day it is a different set of records being processed.
The only way to proces the working set is to have everyone stop using the application and perform the task as the one and only person in the database.

Does anyone experience the same problem? And if so, do you know what is causing it?

Hoping for an answer,

Regards,
Ron
Viewing all 14673 articles
Browse latest View live


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