access-vba

MS Access 2003 - Combine last record of multiple tables into one query or table??

I have a couple of tables that are transaction tables, and I would like to make a simple pivot chart for comparative balances....which happen to be the last record of each of these tables in a field called "balance". so i know how to populate this on a form using a SQL statement, rs.movelast, but i do not know how to get to the pivot ch...

MS Access 2003 - Is there a way to programmatically define the data for a chart?

So I have some VBA for taking charts built with the Form's Chart Wizard, and automatically inserting it into PowerPoint Presentation slides. I use those chart-forms as sub forms within a larger forms that has parameters the user can select to determine what is on the chart. The idea is that the user can determine the parameter, build the...

wanting to move up from ms access, thinking .net? visual studio?

So I wrote a project-management program for a small business using Microsoft Access 2007. Now they've requested lots of additional features (timekeeping, privileged data tiers ...) I personally use Linux, but the whole office uses Windows. I'm relatively new to programming but like to teach myself using projects like this. I'm right...

MS Access 2003 - Unbound Form uses INSERT statement to save to table; what about subforms?

So I have an unbound form that I use to save data to a table on button click. Is there a way I can have subforms for entry that will allow me to save data to the table within that same button click? Basically I want to add more entry options for the user, and while I know other ways to do it, I am particularly curious about doing it thi...

Forcing User's Version of Excel When Creating .xslx file from Access 2007 VBA Code

The Access 2007 app creates an Excel 2007 from a template file and saves as Excel 2007. xlWorkbook.SaveAs "C:\TestFile.xlsx", FileFormat:=51 'Excel 2007 without macros If Excel 2007 is installed, no problem. If both 2003 & 2007 are installed, the file is created as 2007, but the the computer is trying to create with 2003. A "Newer ver...

Calling a MS SQL Server scalar UDF from vba

I am programming an Access 2007 (accdb, not adp) frontend at connect to a SQL Server 2005 backend. How can I call a scalar user defined function from my vba code? ...

VBA: Difference in two ways of declaring a new object? (Trying to understand why my solution works)

I was creating a new object within a loop, and adding that object to a collection; but when I read back the collection after, it was always filled entirely with the last object I had added. I've come up with two ways around this, but I simply do not understand why my initial implementation was wrong. Original: Dim oItem As Variant Dim ...

MS Access 2003 - Message Box: How can I answer "ok" automatically through code

So a couple silly questions: If I include this in some event: MsgBox " ", vbOkOnly, "This little message box" could I then with some more code turn around and 'click the ok button. So that basically the message boox automatically pops up, and then automatically goes away? I know its silly because you want to know, why do you want th...

MS Access 2003 - Option Group frame: can I add text boxes that are part of the frame instead of rad button options?

Ok so this maybe a simple/silly question but I don't know so here goes: In access let's say I want to have a frame control, so I click the option group button and add it to the desgin surface. However, I am not wanting to use this as a option group with radio button selection, instead I would like to add text boxes instead the frame, so...

Access 2003 VBA: Return only the index of the last item selected in a ListBox

I will preface this with saying, this is my first time using listboxes and earlier posts were criticized for lacking detail. So, all help is greatly appreciated and I hope this is enough information without being overkill. Currently, I have a listbox updating a junction table with an on click event (iterates through selected items and i...

Textbox's Value property does not change

I have the following code to run after another control has updated: [Stock No].Requery [Debug].Caption = TypeName([Stock No].Value) + " " + Str([Stock No].Value) If (IsNumeric([Stock No].Value) And [Stock No].Value > 0) Then [Stock Status].Caption = "In stock" Else [Stock Status].Caption = "Not in stock" End If The value of ...

MS Access 2003 : VBA for INSERT INTO statement, new record: how to grab autoid number created?

I have a button click event that takes information from controls and enters it into a table via INSERT INTO SQL statement in VBA. I was wondering if there is anything I could add to this, or some other method to acquire the record number that is created for the record? Could I just turn around and SELECT against the table and use rs.la...

MS Access 2003 - Save button enabling on form open on different tabs

I have a tab control on a form, and a couple different tabs have save buttons on them. Once the user saves data (via SQL statements in VBA), I set the .enabled = false so that they cannot use this button again until moving to a brand new record (which is a button click on the overall form). so when my form open i was going to reference ...

MS Access 2003 - Is there a way to run access (mde) without the access shell around the forms/reports

So I am not sure if I am asking this correctly; let me explain: IS there a way I can run my MDE without the access shell around the forms/reports? The part that provides the menu, and the little application title. I think it is the overall presentation layer form that all my access stuff sits on, but I am not sure. I am just wondering i...

MS Access 2003 - Embedded Excel Spreadsheet on Access form

Let's say I have an embedded Excel Spreadsheet on a Microsoft Access form. I call the object frame ExcelFrame and I add a text box on the form called txtA1 and I add a button on the form called cmdInsert I want to type "Hello World" into the text box, click the button and have it appear in the A1 cell on that spreadsheet. What V...

MS Access 2003 - ordering the string values for a listbox not alphabetical

Here is a silly question. Lets say I have a query that produces for a list box, and it produces values for three stores Store A 18 Store B 32 Store C 54 Now if I ORDER BY in the sql statement the only thing it will do is descending or ascending alphabetically but I want a certain order (only because THEY WANT A CERTAIN ORD...

MS Access 2003 - Failure to create MDE file: error VBA is corrupt?

Ok so this is a brand new snag I have run into. I am trying to launch a new MDE from my source MDB file, and it is locking up Access. So in my mdb, I am first compacting and repairing, and then selecting create a new mde (just as I have done many times before). It looks like it is starting the process, but never gets to where it comp...

Excel 2003 VBA - Method to duplicate this code that select and colors rows

so this is a fragment of a procedure that exports a dataset from access to excel Dim rs As Recordset Dim intMaxCol As Integer Dim intMaxRow As Integer Dim objxls As Excel.Application Dim objWkb As Excel.Workbook Dim objSht As Excel.Worksheet Set rs = CurrentDb.OpenRecordset("qryOutput", dbOpenSnapshot) intMaxCol = rs.Fields.Count If...

How to reference an embedded PowerPoint or Excel file in a form in Access?

So if I was to take a an Access form, and embed either an Excel spreadsheet into it or a PowerPoint deck, how would I reference it in VBA code? I know I have to set the libraries, name the frame of the OLE object, and use applicable syntax to whatever I want to do, with whatever I stick in the form, however the only things I have ever d...

Access Database using do.cmd openform where clasue - returning all values

DoCmd.OpenForm "Database Search", acFormDS, , srcLastName & "AND " & srcFirstName This is only a small sample of the where clause - there are many more terms. First, there is a set of If, Then type tings up top that set the variable srcLastName and srcFirstName to some value. These are not the problem and work just fine. The trouble i...