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

VBA Run-time Error

$
0
0

Run-time Error 3021: No Current Record

I get this error while I try to Import Excel file in one of the MS Access tables using VBA. Attaching screenshot, how to solve this please??
Just to be clear, I've made sure "tblBoQ" table and "C:\Import\BoQ" Excel files are at place. So there's no question about it.

Thanks.


Unrecognized database format 'D:\...accdb'

$
0
0

Good day! 

Please help me to recover the data in our database on a shared network. The said file contains data that is very important and I don't have any back up.

The access file can't open. It says "Unrecognized database format 'D:\....accdb'"

huhuhu... 


getting "Run Time error 13 with Access 2010 command DoCmd.TransferSpreadsheet acExport

$
0
0

I am trying to export a file to a worksheet"BGWE" with the script for a button below, but get every time the error : "Run Time  - error 13"? The commands andobjects or data definition looks to be fine, but can't workout why I get the error still 

Private Sub CmdBGWtofile_Click()
'------------------------------------------------------------
' CmdBGWtofile_Click
'
'------------------------------------------------------------
    Dim App As Object
    Dim File As Object
    Dim rs As Recordset
    Set App = CreateObject("Excel.Application")
    Set File = App.Workbooks.Open("C:\Users\Documents\Template.xlsx")
    Set ws = File.Worksheets("BGWE")
    ws.Activate
    DoCmd.TransferSpreadsheet acExport, "Setting BGWE final 2015", acSpreadsheetTypeExcel12Xml, "BGWE!", "C:\Users\Documents\Template.xlsx", True
    App.Workbooks.Close
End Sub

Access 2007: Fatal security issue

$
0
0

An A2007 application (ACCDR) is linked to a password protected database. How to get the password?

1. Rename an A2007 ACCDR to ACCDE.

2. Open the ACCDE in Access while pressing Shift key.

3. Check for some linked tables. All you need to know is a name of a linked table in a "password protected" database.

4. Press Ctrl+G to switch  to debug window.

5. In debug window write down the following and press Enter:

?CurrentDb.TableDefs("LinkedTableName").Connect

6. Voilá, you've got connection string with password in it!!!

I have tried to protect A2007 project DB with a password and translate it to ACCDE + rename to ACCDR. The problem is that an end user cannot run the application in A2007 Runtime without knowing the project's password.

Is there any workaround, please?

Thank you very much in advance.


P.S. My former account was Vladimir Cvajniga but I can't access it anymore, see http://social.msdn.microsoft.com/Forums/office/en-US/5b1284eb-a74f-4c55-9d4c-d6fb6eb25d48/fatal-how-can-i-login-to-my-account?forum=Offtopic#5b1284eb-a74f-4c55-9d4c-d6fb6eb25d48.


Trim function for report data ?

$
0
0

I'm coding a report and it is working fine but is printing out a table column with some bad data in it. Several records have leading spaces in the data, they come out at the top of the report and look bad.

I've tried the TRIM function in the SQL and in the control source but Access does not like either.

How can I apply the TRIM function as this column is read into the report?

Thanks.

trying to find syntax on getting return value of Access qry into Word. have two qry's in Access, trying to get their values to Word UserForm Code.

$
0
0

Only problem is passing the data from Access to Word so Word can use that data in Word's VBA code.

I have two queries in Access 2013 64bit, Win7, VBA 7.1       Word 2013 64 bit, Win7 VBA 7.1

One qry returns only one string.

Second qry returns many more, current number of rows is 215 and growing and this qry has parameters to maybe narrow that number.

I have been using the code below in a

Word Document UserForm to call this Access database that holds the info.

Dim MyPath As String

Dim MyObject As Object

  MyPath = CStr("C:\Users\Mark\Documents\NameFinder2.accdb")

Set MyObject = GetObject(MyPath)

MyObject.Visible = True     'seems needs to be True to see form.

MyObject.DoCmd.OpenForm "frmTblLands"     'this does open frmTblLands in the database.

It is as though I opened Access from a Desktop short cut.  All features useable. 

IF I could figure out anyone of these possible ways to get the info from Access to Word VBA I would almost be done.

1. In Word VBA refer to a TextBox on a Access Form to get the single value, after Access runs a qry or other code.

2. In Access declare a Public Variable1 in a standard module.  Then elsewhere in Access assign value to Variable1.  

                       Then Back in Word use that Same Public Variable1 in Word VBA code.

3. If I can do # 2, then I figure I could Also declare in a standard module in Access, Public Arrary1, holding all the rows returned by QryManyRows in Access.  Elsewhere in Access, parameters passed to QryManyRows, then Arrary1 gets rows of qry. 


Mark J

Access 2016 Web App - Cannot save data changes

$
0
0

I have successfully installed the Project Management Template on my SharePoint 2013 site. I have loaded data without mishap.

Upon trying to update a loaded task using the drop down choice (Not started-In progress-complete-etc) of "complete" and then clicking on the save button, the screen will immediately revert to "in progress". I have tried to modify this task in all the various views with the same result. There also appears to be a tie in to the "% Complete" box.

Any suggestions?

Thank you

Dan

document.body.innerhtml doesn´t work with internet explorer 9

$
0
0

Hi,

Im using:

dim ie as object

set ie = createobject("internetexplorer.application")

s = ie.document.body.innerhtml

to retrieve the html source for the s variable.

This has worked until we switched to windows 7 and internet explorer 9.

How do I get the html now?

thanks!


Access 2013 Web App - Get Location Data from Mobile Device

$
0
0

Hello,

I have built a web app using Access 2013 and it is hosted on SharePoint using my Office 365 E3 subscription.

The app is used via the browser on a mobile phone (Running Android) and it would be extremely useful for the app be able to capture GPS location data from the phone, by pressing an action button for example, and storing the (Lat. long.) coordinates in a data table within the app.

I have read this is possible on other web apps by using browser geolocation features but can this be done in an Access Web App?

Many thanks in advance for any help/guidance on this

Increment a field by 1

$
0
0

I want to have a field in my query that increments by 1 every time a row is displayed.
    Name          Number
    Joe Smith         1
    Bob Jones         2
and so on.

Don't want to save the number in a table. Just want to number the row.


Gary

Maximize Window Access 2013

$
0
0
In Access 2013 I watched a few videos but don't achieve the result of my pages being full screen. If main menu opens submenus or forms. I do set PoP up  to yes on each page and did set up the little macro as the video suggest. It seems my pages are moving around and never really full screen.

Company Info

$
0
0
After two months and many hours I am still a rookie. What is the best way in Access 2013 to keep your companies own information. In a table or in a form in labels or text fields. I try to carry the information across to forms and reports (Invoices) but somehow still don't achieve it.

Import XML does NOTHING

$
0
0

Thanks for taking the time to read my question.

I'd like to use MS Access 2010 to import XML files to review the data of all the files together.

I'm in the "External Data" tab, I click on "XML File", I navigate to my file, Select "Structure and Data" then click OK.

.... then nothing happens.

The very first time I tried I received an error: "Error in loading dll". I found this page:https://support.microsoft.com/en-us/kb/2019235 and my registry is now up to date (I navigated to the spot and made sure, and also have made sure both ACEDAO.DLL and dao360.dll exist... they do) I've also restarted and created new accdb databases in different locations, but nothing happens. Any help would be great. Thanks,Brad (Sorry for the poor formatting here... hitting the Enter key is not starting a new line)

Sorry forgot to include the XML that I'm trying to import as a test:

<?xml version="1.0" encoding="UTF-8"?><xml850><Group1><Field1>Data</Field1></Group1></xml850>

Sum field showing as blank, not solved by reboot

$
0
0

I’m having problems with an Access 2010 compiled program showing the sum of a calculated field as blank on 1 computer. It works fine on every other computer.  I have not tried summing a non calculated field. Please note - this is different from the Microsoft problem that requires a reboot to fix. A reboot has not helped. 

I have two Access programs that have an Access front end and SQL back end.  On my client’s computer they use the Access 2010 runtime. The first program, Program A, works as expected.  The second program, Program B, is the one that has problems. I have an invoice form that has a subform with inventory line items on it. The subtotal is a calculated field and it displays properly.  There is another field that is the sum of the subtotal that is the problem. This sum is showing as blank.   If I do an NZ the sum will show as zero. I have the sum as a hidden field on each line of the subform. I made that visible while testing.  I created this invoice form several years ago starting from the invoice in Program A. The basic function of summing the subtotal of the lines has not changed.  The total will appear if I press F9 or have code in my program that does a refresh. As soon as I edit the quantity or add a new inventory line the totals are gone again.

This problem occurs on only one computer.  It’s my clients so I don’t have a great test environment. This is a new Windows 8.1 computer.  My client said they have run the program successfully on other 8.1 machines. I don’t have an 8.1 machine to test with.  Here is what I’ve done. 

  • I assumed this was a reference program.  I added something to check for missing references. They were fine.
  • I had someone reboot the computer several times. 
  • I uninstalled my Access programs and reinstalled as administrator. Note both Programs A and B are installed with the same installation program.
  • I made sure Access 2010 Runtime SP 2 is installed.
  • Still thinking it was a reference problem, I ran one program that is part of the installation separately as administrator. 
  • I ran a batch file to make sure one set of references used for credit cards was registered. 
  • In order to determine if it was a reference problem, I removed several references and remarked out a lot of code so the references were the same in Program A and Program B.
  • I checked the Trust Center.  It’s the same on both programs.
  • I renamed Program B to Program A’s name just to see if that made a difference.
  • I checked the Add Ins, both programs are the same.

I’ve had the program up for hours before and I see it refresh, but the totals do not appear.

Now I’m at a loss.  Every update has been installed. Does anyone have a suggestion of what to try?  It doesn’t have anything to do with the data. I can look at invoices created in Program B with Program A and they sum correctly. Also, I’m looking at two different forms in Program B and they both have the same problem. My boss wants me to put in a bunch of refreshes, but I’m concerned about the speed and what other problems might be lingering that I wouldn’t find out until later.

Update my query after the recordset is printed

$
0
0

Hi everyone,
I have a temporary recorset (Données facture RequêteTEMP) that store all orders that are not print for a particular table, however, when I run the code below by clicking on a button near the table button, it prints all the invoices correctly, but after all unprinted orders are printed, I want to empty that recordset by having these fields received the TRUE or -1 value.

[CouponCuisineImprimé] - [FactureImprimée] and [FactureImpriméeParTable]

I tried to put this code somewhere into the original code that makes the invoices print and I have no success so far:

With rst
 While Not .EOF
 rst.Edit
 ![CouponCuisineImprimé] = -1
 ![FactureImprimée] = -1
 ![FactureImpriméeParTable] = -1
 .Update
 .MoveNext
 Wend
 End With

Here is the code:

Private Sub ImprimerTousTable1_Click()
On Error GoTo Err_Handler

    Dim NoTable As Integer
    Dim intTableNo As Integer
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim rst1 As DAO.Recordset
    Dim strSQL As String
    Dim strSQL1 As String
    Dim i As Integer

    Set dbs = CurrentDb()

strSQL = "SELECT * FROM [Données facture RequêteTEMP] WHERE[Données facture RequêteTEMP].[Réf client] = 1"

Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)

strSQL1 = "SELECT * FROM [Données facture Requête par table] WHERE [Données facture Requête par table].[Réf client] = 1"
Set rst1 = CurrentDb.OpenRecordset(strSQL1, dbOpenDynaset, dbSeeChanges)

If ImprimerFacturesParTable = "Oui" And rst.RecordCount > 0 Then

         rst.MoveLast
         rst.MoveFirst

         Do Until rst.EOF

         DoCmd.OpenReport "FacturePaiementsParTable", acViewNormal, , "[Réf commande]=" & rst1![Réf commande]
With rst
    For i = 0 To rst1![Réf commande]
         .Edit
         .Update
    Next
End With
             rst1.MoveNext
         Loop

     Else
         MsgBox ("Il n'y a aucune commande ou aucun items à imprimer pour cette table!")
     End If

Closerst:
    rst.Close
    rst1.Close
    dbs.Close
    Set rst = Nothing
    Set rst1 = Nothing
    Set dbs = Nothing

Exit_Handler:
    Exit Sub

Err_Handler:
    If Err = 3021 Or Err = 3265 Then
    Resume Exit_Handler
    Else
    MsgBox "Error " & Err.Number & ": " & Err.Description, vbExclamation, "Erreur lorsque clique sur imprimer toutes les commandes Table1_Click()"
    Resume Exit_Handler
    End If

End Sub

I verify and I can check manually these 3 fields after the printing so how can I automate this task?

Thank you

Claude from Québec, Canada


Claude Larocque


com.ExecuteNonQuery() function not inserting data and no error message.

$
0
0

Hi, From a Windows desktop application I try to insert a row into MS Access database table using OleDb Command with ExecuteNonQuery(). Code executing normally with out errors, but data not inserted to database. Here is the code.

private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                OleDbCommand com = new OleDbCommand("Insert into Devo (DID,Dname,Address,Phone) values(@id,@name,@address,@phone)", conn);
                com.Parameters.AddWithValue("@id", lblCnt.Text);
                com.Parameters.AddWithValue("@name", txtName.Text);
                com.Parameters.AddWithValue("@address", txtAddress.Text);
                com.Parameters.AddWithValue("@phone", txtPhone.Text);
                conn.Open();
                int x = com.ExecuteNonQuery();
                MessageBox.Show("New Person info has been saved."+x.ToString(), "Saved", MessageBoxButtons.OK);
                txtPhone.Text = "";
                txtAddress.Text = "";
                txtName.Text = "";
                txtGotram.Text = "";
                lblCnt.Text = (Convert.ToInt32(lblCnt.Text)+1).ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                conn.Close();
            }
        }



K.R.V.Prasad Sarma


Can I store hyperlinks to BookMarks in Word outside of Word?

$
0
0

I have hyperlinks to bookmarks in a word document. No problem, IF Link is from one spot in word document to another spot in same word document.

And seems I CAN have One word document with hyperlinks to bookmarks in another word document.

But, when I tried to have a table of hyperlinks in an Access Table, in the field that takes hyperlinks.

I can have a hyperlink in the Access table to open a Word file. That works great.

But I am unable to have a hyperlink in an Access table that goes to ANY bookmark in a Word document.

Even parts of dialog box used in Word to refer to bookmarks is missing in the Access “Edit hyperlink” dialog box. 

After click on Edit, caption of dialog box is “Insert Link”,  "Existing File"  "Recent Files" and get the Word doc with all the bookmarks.

But unable to reference any bookmarks in the Word doc.

does that mean there is no way to do this?

Mark J


Mark J

Change of pricing.

$
0
0

My business is a car rental business, renting cars on a monthly basis as long as the customer wants to keep it.

I calculate a rental rate against every car in the car table. The rate I charge is calculated, taking book value and management adjustment into account. On average my customers keep cars for 15 months. On return, we revalue the car and when we rent it again the rate will be different. All previous automatically generated invoices are connected to that rate field. If the rate change, I will change all old invoices?? What do I do to have a new rate for new invoices only?

I use the expression =round[(rentalinstallment,-2)] to round to the nearest 100. Where rentalinstallment is the final calculated field that keeps the installment I want to charge from the customer.

Create a form

$
0
0

I record a high school track meet long jump event. There are usually around 30 students.

Each student gets 3 jump attempts. Then 6 students with the longest jump get to have 3 additional attempts.

The current table I use is:

This the form I use to entry my jump data:

I wanted to normalize the table so created a table like this:

How do I create a form using the table above that looks like the form I am currently using?

I have tried a crosstab query but because I am a beginner with Access I have had zero luck.

Thanks for taking the time read all this.


Gary

Access, PowerQuery, or...

$
0
0

Hi and thanks for reading my first post...

I need to make a decision about which tool to use for a project and could use your expert help. I have a bunch of financial files in Excel that are about 450MB per file, so temporarily about double when saving them. Undoable while travelling and working on a Windows based tablet as it takes 15 minutes to even open the files, let alone edit and save them. In these files I use downloaded stock prices from Yahoo Finance for which I calculate all kinds of moving averages and investment scenarios. The daily data is in 10,000 rows, the different moving averages (in steps from 5-300 days, plus 2-52 weeks, plus 1-12 months) in 150 columns. All these cells have Excel formulas in them to calculate the moving averages. Next to these 150 columns there's over 2,000 columns filled with IF-formulas that calculate crossover points between the moving averages, say, if the 20 day moving average crosses above the 80 day moving average. That's an enormous task and I find it incredible that Excel can actually do that. But...

Isn't there a better and faster way to do so? I have to do all sorts of find & replace tricks to update part of the formulas because I can't use even more nesting and stuff. I was thinking in the direction of Access or PowerQuery so I can load and rework all the data easily with a macro and then design the formulas once for all columns after which the software copies the results of those formulas (so not the formulas themselves like in Excel) for all rows.

Now my question is what tool would be best suited for such a project? Access has VBA which is very powerful but it also has a 65,000 row limitation which will be important for other projects. Furthermore I'm using Office 2013, Access 2013 is not for sale anymore, and when buying Access 2016 I have to upgrade the whole suite (while travelling long-term in Africa with terrible internet connections so it will take a week to download!). Would PowerQuery be a solition? Does it have the flexibility I have with VBA and SQL? Any limitations I might run into? Any other tools?

Your advice is highly appreciated!

Tnx, drftr.

== Cross-posted on the PowerQuery forum ==

Viewing all 14673 articles
Browse latest View live


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