Microsoft Access





Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

Share tech news, updates, or what's on your mind.

Sign up to Post

Access 32Bit Working Fine 3 Years... Trying To Convert to 64Bit... Not Working

In 64Bit Code the fail is on the LoadLibrary 64Bit function it does not load the library in the 64 vs the 32 code...

have all the dills in all the right places same for both and when i debug the CurrentDB dir is correct for Lib to load... color me confused.

Access 32Bit Code (working)
Option Explicit

Public Declare Function MergePDFDocuments Lib "StrStorage.dll" _
    (ByVal PDFMaster As String, _
    ByVal PDFChild As String _
    ) As Boolean
Private Declare Function FreeLibrary Lib "kernel32" _
(ByVal hLibModule As Long) As Long

Private Declare Function LoadLibrary Lib "kernel32" _
Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

'Instance returned from LoadLibrary calls
Private hLibDynaPDF As Long
Private hLibStrStorage As Long

Public Function LoadLib() As Boolean
Dim s As String
Dim blRet As Boolean, A As String

On Error Resume Next

' *** Please Note ***
' If you are going to process many reports at once then to improve performance you
' should only call LoadLib once.

' May 16/2008
' Always look in the folder where this MDB resides First before checking the System folder.

LoadLib = False

' If we aready loaded then free the library
If hLibDynaPDF <> 0 Then
    hLibDynaPDF = FreeLibrary(hLibDynaPDF)
End If

' Our error string
s = "Sorry...cannot find the DynaPDF.dll

Open in new window

Microsoft Azure 2017
LVL 13
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

I have  access o365
I have a really weird problem.

When i put a form in design mode.
The cursor keeps spinning for several seconds.
and then spins again.
it repeats about five times.

Then when i try to click on any part of the form.
It starts all over again ?

Any suggestions
I use a main form  (recipe) with a datasheet subform (ingredients).  

In the subform, the user can add different ingredients. After each ingredient selected (via combobox) the datasheet is updated for the correct price and quantity.  However, I need to add a computed column for PRICE * QTY for each row without this field being stored in the underlying table (unbound). The reason is that the price should be fetched in the ingredients table to ensure that we always use the latest ingredient price. At the moment, I use =DLookUp("Price","Ingredients","Id=" & Nz([cmbIngredient],0))*[xQty]) which works fine. Is there a better way to do it?

Second, I need to display the sum of all ingredient costs ( in the subform) on the main form. What is the best way to do this?

Thank you so much for any help!
We have sql server with database and tables in it. If I can connect to it via odbc, I can link to the tables in access database. After the linking I am easily able to make changes, add and delete the data in the tables. Can anyone suggest a lock system (user verification) that will enable user to link to the tables but not make any changes to the data in the table. My DBA can do it but I wanted to know opinion from the experts to propose a solution.

Thank you.
Hello Experts,

I tried to append the data from the excel file to access table and for some reason some o the filed comes blank. however, there is data in the excel file. can I get any help with this?
I have a Save and Create new record button on my form but, I need to ensure all the required fields are not null before the record can be saved and a new record open....This is my starting code:

Private Sub SaveAndCreate_Click()

End Sub
Hi Experts,
Can someone explain what does this do in a form timer?

Private Sub Form_Timer()
    Echo False
    Sleep 100
    Echo True
    Me.TimerInterval = 0
End Sub

what happen is I remove the "sleep 100", is going to affect the form?

also what are these functions for, do they need to be in a module of every program or can be omit:
Function apiGetScrollInfo
Function apiSetScrollInfo
Function GetWindowLong
Function SendMessage
Function apiGetClassName
Function apiGetParent
Function apiGetWindowLong
Function apiGetWindow

Using MS Access 2013, I've developed an application that's been running fine for over a year. Once development is completed on changes, I use debug compile to make sure no issues are found. Then I create an ACCDE and push the new release into out testing environment.

 Something changed about a week ago. The ACCDB copy run fine. However, now each and every time I create a new ACCDE and try to launch the ACCDE it crashes every time.
 I have spent numerous hours researching and have no idea what is causing this. I've attached a screen capture of the MS Access crash window.

VBA compiles cleanly.  New ACCDE files from those affected ACCDB files still crash.

The plot thickens.  Spent last Thursday & Friday recovering from an older ACCDB that compiles and ACCDE runs.  At 7am I stopped, compacted, decompiled, made ACCDE. Runs fine. So made a backup of my ACCDB.  At 8am, did same thing. Everything fine. At 10am did same thing, everything fine, made new backup.  At 11am packed, decompiled, made ACCDE. Crashes.  Copied back my 10am ACCDB. Made ACCDE, crashes.  Went to my 8am backup. made new ACCDE, crashes.

 I also attached a zipped copy of the error exported from the system event viewer.

This is driving me crazy. I cant work under these conditions.  Any help will be greatly appreciated. I'm at a complete stand still until I figure this out.
ms app that displays a pdf file in an access sub form. For years had been using an adobe activex
add-in to run this by providing a pdf file path as the control source. This has been redacted or never legit in the first place after 2010 version. Now I have to use a MS web browser control in place of the adobe activex control. The app let's the user update info in another sub form and then "Refresh" the pdf by recreating the file. During this process, I'm getting rt error 2501 the outputto operation has been cancelled when I try to refresh. It appears that adobe reader is still running in the background, which I think is causing the error.
I'm looking for a code snippet to close the adobe reader app.

The vba in question is
DoCmd.OpenReport "Work Order Report", acViewReport, , "JOB.JOB_NO='" & CurJobNo & "'"   ', acHidden
DoCmd.OutputTo acOutputReport, "Work Order Report", acFormatPDF, Temp1Path, False
DoCmd.Close acReport, "Work Order Report"

the docmd.Outputto.. item is where it fails
I've got an access DB set up with a large number of companies and a primary [ID] key number for each one. There are many associated tables which provide data about certain aspects (e.g. revs in 2018) with the company ID as a foreign key. Several of these companies have merged so I've got separate records for the company (and all the linked other tables) for Company X [company Y part] and Company X [company Z part].  
I run a whole bunch of queries and forms from this table set up, and at the moment it obviously brings up the answers as two separate records. But for ones which I identify (perhaps with a separate table for mergers) I'd like it bring up the combined records. Is there a way of doing this?
Should you be charging more for IT Services?
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

I'm struggling to find the right syntax to connect to an excel.chart OLE object from Access using OLE.
I have managed to link to a specific range on a sheet using the following code (not an easy task itself)

With Forms.Item("Form2").Controls.Item("OLEUnbound2")    'Name of form and OLE object on form
.Locked = False 'Make sure not locked (default setting is locked!)
.Enabled = True 'Make sure enabled (default setting is not enabled!)
.Class = "Excel.Sheet" ' Set class name.
 ' Specify type of object.
.OLETypeAllowed = acOLELinked
 ' Specify source file.
.SourceDoc = ".............\<Filename.xlsx>"
 ' Specify data to create link to.
.SourceItem = "Sheet2!R1C3:R5C7"
 ' Create linked object.
.Action = acOLECreateLink
 ' Adjust control size.
.SizeMode = acOLESizeZoom
End With

However if I now try and attach to a  .class="Excel.Chart" and change .SourceItem to (for instance) "Sheet2Chart5" it doesn't work and I get an error.
There must be some syntax required by the excel OLE server in order to refer to charts that you need to set .SourceItem to in order to get this to work.
Does anyone know this please?

[PS I know I can use a work around for one item to link to an area on a sheet where I put the graph, but would be helpful to understand the Excel.Chart syntax for various reasons]
Many thanks
I have a SQL database where I need to cycle thru 25 queries to make and append to a table so I can pull the right information.     I have one table w/25 values spread across 25 fields and in MS Access I have a form button the user presses and it runs the mk table and append queries.   I tried to replicate this in SQL starting w/creating a view and then using the Instead trigger - but that approach didn't work.    I'm not sure how to approach this problem or what terms/key words I should be looking at.   Any assistance would be greatly appreciated.
We get data from a client established SSRS.  Is there a way to set up a connection to SSRS in Access to pull that data in?
my ms access application(vba) creates .xml files
I need to upload one .xml file to a web page using winhttp requests
I have the web site url address and I have  a session ID
the url address is https://............
here is my code        
[code]]Set http = CreateObject("WinHTTP.WinHTTPrequest.5.1")

    http.Open "GET", strformurl, False
          http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
           http.setRequestHeader "Cookie", session
          http.waitForResponse 400
           http.response = response
          msgbox "response =- " & response
            http.send (strFile)
I have an access 2002 runtime running 3 pcs accessing data from a server.  2 pcs are windows 7 and one windows 10. The Windows 10 machine has an access version 16 on it.

When two or more users are accessing data the ethernet speeds are 1-1000kbs when one user is accessing data the ethernet speeds are in the tens of megabits and usually running up to 10 times faster.

We have disabled Leasing on the server (a known Microsoft issue)

I have 15 other installations with exact same application and all data on servers all using various windows OSs including a good number of Windows 10. The server has been checked by two independent IT companies and checked Ping rates etc. etc.

The only thing I am not sure about is if Leasing has to be disabled at each pc.
When I call a Stored Procedure in VBA in MS Access that has a lot of output parameters, when i look in SQL Server Profiler there are lots of records like exec sp_cursorfetch 180150003,2,1,1

This happens after the connection is opened, when the first parameter is defined in VBA

It is not slow when the .Execute is called.

in 1 stored procedure with over 100 OUTPUT Parameters it can take 0.5 seconds.

if I return a RecordSet with the same data in side - there is no delay - but I prefer Output Paramters when i'm returning a single row

Why is this?

This is an example of my code:

    Dim cnn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim cmd As New ADODB.Command
    ' Connect to the database
    cnn.Open Driver={ODBC Driver 17 for SQL Server};Server=sqlserver\Db;Database=DbName;Trusted_Connection=yes;
    cnn.CursorLocation = adUseClient
    ' Set up the command object
    With cmd
        .ActiveConnection = cnn
        .CommandType = adCmdStoredProc
        .CommandText = "Stored_Proc_Name"
        .Parameters("@Para1") = Para1
        .Parameters("@2Para") = Para2
        .Parameters("@Para3") = Para3
        .Parameters("@Para4") = Para4
        Set rs = .Execute
        OutPara1= Nz(.Parameters("@OutPara1"), 0)
        OutPara2= Nz(.Parameters("@OutPara2"), 0)
        OutPara3= Nz(.Parameters("@OutPara3"), 0)
        OutPara4= Nz(.Parameters("@OutPara4"), 

Open in new window

I am getting the following error when I try to open my access database. Cannot open a database created with a previous version of your application.


I'm trying to populate a text box on a form by clicking an item in a listbox (simple multi-select).  The name of the textbox is txtSelectedDriveThruInspectionsMonths.  The name of the listbox is listMonths.  Here is my code...

Private Sub listMonths_Click()
On Error GoTo Err_listMonths_Click

    Dim SelectedValues As String
    Dim frm As Form
    Dim varItem As Variant
    Dim listMonths As Control
    Set listMonths = Me!txtSelectedDriveThruInspectionsMonths

    For Each varItem In listMonths.ItemsSelected
        If SelectedValues > "" Then
            SelectedValues = SelectedValues & ", " & listMonths.ItemData(varItem)
            SelectedValues = listMonths.ItemData(varItem)
        End If
    Next varItem
    Me!txtSelectedDriveThruInspectionsMonths = SelectedValues

    Exit Sub

    MsgBox "Error Number: " & Err.Number & vbCrLf & "Error Description: " & Err.Description & vbCrLf & "Error Source: " & Err.Source
    Resume Exit_listMonths_Click
End Sub

Open in new window

But the error I'm getting when I select an item is:

"You entered an expression that has an invalid reference to the property ItemsSelected."
Hi Experts
Please I want a code or a mask to enter phone numbers assigned to one of the two … first for mobile phone numbers, for example, 248-0072-0115 (202) and the second is a pattern for regular telephone numbers (049-39-260) 202)
- For entering phone numbers, regardless of whether the number is for a mobile phone or for a normal phone, I would like to distinguish between the two types by typing zero if it starts with zero taking the mobile pattern and not starting with zero taking the normal pattern
Exploring SharePoint 2016
LVL 13
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Hi all, I have main form called workorder(single view) with subform paygroup(datasheet form)
this subform paygroup is having subform called payitem(continous form)
there is unbound textbox called totalvalue in footer section of payitem
now i want to refer that control totalvalue in main form workorder
can someone tell me how can i refer that control total value using vba code or
 i want that totalvalue to be displayed in mainform so is there anyway i can write expression to get that totalvalue in mainform
All-invoices1.accdbms access print invoices on a preprinted form

I need assistance to make the report printed on preprinted (A4 SIZE- DOT MATRIX ‎PRINTER)  

I need assistance to make the following change : printed on preprinted form with the following :
‎1.‎      Form "invbase_fm"  need to change customer text box to ComboBox  that show ‎customer num and customer name ‎
        All-invoices1.accdbDetails will show above customer in the same form
‎2.‎      Add button to print only selected invoices .‎
‎3.‎      Need to printed only 8 row from the invoice in same page remaining row in second ‎page.‎
Good morning,

I am having problems with a piece of vba

Set rs = CurrentDb.OpenRecordset(“SELECT * FROM qryPropertyMatching”, dbOpenDynaset, dbSeeChanges)

The error that is coming back is Too few parameters, expected 3


any ideas?
Hi Experts
Is there a way to do conditional formatting.
So if we write a number in any field and there is a similar number in another field, the conditional formatting will work ... as shown in the picture
I added several dlookup queries to an existing report.  Now the first page is blank.   How do I correct this?
Hi all, in ms access form can we hide values of combo box row source based on condition using vba code?
i mean say combo box row source is getting 5 records in drop down but i want to display only 3 records based on condition?
so user can initially see only 3 records in drop down but in case if he needs to enter value which wasn''t there in those 3 records but still exists in other 2 records then they need to able to select that record which wasn't there in drop down initially
is this possible using vba code? to hide values depending on condition?

Microsoft Access





Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.