access-vba

Enabling field visibility from combo box selection in Access 2007

I have a form in Microsoft Access 2007 called System, and a combo box called Utility within this form. Below this is yet another combo box called Utility_FOO, and I have disabled its visibility by default. One of the options in Utilities is a checkbox labeled 'FOO.' I want Utility_FOO to become visible whenever FOO is selected. I hav...

Transform Excel files to the existing database via the form in Access.

Hello, I has not a lot of experience in VBA programming. What I need - is the possibility to create a simple form to extract some Excel file to the defined table by adding the records. Could you please tell me what function or a set of functions can be used in this case: to open the Excel file, define the spreadsheet, extract data inse...

MS Access DB on network with multiple users.

Hello All, I have an MS Access database on a network drive with a userform which has multiple users (All using at the same time) The form runs an update-query which will add data into a raw data table. Does anybody know how I can make this work if two(or more) users run the update query at the same time? I assume this has to be done ...

Access VBA Formatting

Hey all, I managed to integrate my Database quite well with Excel in the end, but in the end after I showed it to the bosses they asked me to develop the forms and reports in Access again. That did not take too long fortunately, so I ended up doing two front ends for one back end Database. But in the end it'll be a fully Access database ...

How can I move a listbox around an Access form using VBA?

I'm really brand new to all this, so excuse me if it's a stupid question. I've got two list boxes on an MS Access form. I'm resizing the list boxes based on how much data I'm getting back. However, this form needs to print, and the list boxes have enough data in them that they need to stack one above the other. When the first list box ex...

Mail merge started by VBA in Access let Word open Database again

Hi, I'm working on a Access database which generates some mails with mail merge called from VBA code in the Access database. The problem is that if I open a new Word document and start the mail merge (VBA), Word opens the same Access database (which is already open) to get the data. Is there any way to prevent this? So that the already ...

Event needed on computed field

I have a field (Total) that has a computed value. This is the control source: =[FrmSupplierQuote].[Form].[TotalSupplierCost] This field is updating just fine when the subform is updated When this field updates I wish to execute the subroutine that updates the field FinalPrice: Public Sub Update_FinalPrice() Me.FinalPrice = Round(...

Access VBA - How would I have a loop in VBA that allows me to loop through control names

So I have like 10 text boxes on a form that are actually used for display not entry. They are are named like txt_001_Name, txt_002_Title, etc..what kind of loop is used for this. I was wondering what kind of VBA would I use to actually loop through the names of the text boxes. So if I was to debug.print it would look like: txt_001_Titl...

Why is After Update DSUM Before Update Value

I have a subForm, aContinuous Form, filtered by the field JobItemId, that has a field Price, after price is updated I wish to determine the new total of Prices for JobItemId and pass this for processing elsewhere. I have this code: Private Sub Price_AfterUpdate() Dim TotalCost As Currency Dim strFilter As String strFilter = "[...

Access 2000 automaticly add text to a form entry field.

I have an Access 2000 database with a custom form. People are entering info into this. On one of the fields I want to automatically append a ".zip" to one of the fields. How? ...

Access OutputTo acOutputReport prints extra page

I have a report in Access that we want split and exported to .rtf based on a group ID filter. The split works, but in each .rtf file I get an extra page at the end with the page header section but no detail or group footers. My report has the report header section hidden, page header taking up 1/2 the page, groupID header hidden, detai...

Maintaining modules/macros in Access.

Hey guys I've written a little module/macro that helps our inventory department, they will need to run the module/macro a few times every month. They receive the databases from out in the field these are exported from some 3rd party inventory tracking system we have. My question, is there any way to install this module/macro outside of ...

Response of Access VBA when handing wrong password for import of encrypted password

I am using this code for importing encrypted excel into access 2007: xlApp.Workbooks.Open FileName:=dlgOpen.SelectedItems(i), PASSWORD:=strPasswd It works nicely if I give the correct password, or nothing (I'll prompt user to enter the password again for they give a blank password), but not for wrong password, Access will prompt for e...

Access 2007 how use VBA to loop through Query and loop through print reports.

Hi, I have an existing module that prints a series of reports based on a query (CAP classroom Report gr 5) by looping through another table (School_room_grade). The reports were printed based on a WhereCondition in the module that matched the rows in the School_room_grade table. This process is used so that each school_room_grade combo ...

MS Access: .Close required after .RecordSetClone ?

In an MS-Access form, I have the following code attached to an event: Dim frm As Form, rs As Recordset Set rs = Me.RecordsetClone 'do some stuff with rs ' rs.Close Set rs = Nothing Set frm = Nothing My question is: is the rs.Close required ? Is it even good (undesired side effects ?) ...

How to Reference Individual Form Elements in a MS Access Continuous Form

MS Access Scenario: I am using a form (we'll call it the select_contract form) and a subform (we'll call it the employee_allocations_by_contract subform). The select_contract form: Is unbound. Contains a combobox that allows the user to select a contract id. The employee_allocations_by_contract subform: Is a continuous form....

Help me converting this code from Java to VBA

Hi, I need a to create a VBA function that extract a text from a string I wrote this java method public static String extract(String str) { String s = str.substring(str.indexOf("'"),str.lastIndexOf("'")); String fg = s.substring(s.indexOf("'")+1, s.indexOf("to")-2); String sg = s.substring(s.indexOf("to")+4); return s...

Create a list of months between two dates in Access

I'm doing things with Microsoft Access. Now i want to make a list of dates between two dates. for example input : 1-1-2010 and 5-1-2010 give me the values. 1-1-2010 2-1-2010 3-1-2010 4-1-2010 5-1-2010 I want to do this in SQL if it's possible, otherwise in VBA. ...

Storing and recreating relations in Access

I'm wondering if it is possible to use VBA to store, delete and recreate relationships on tables in Access VBA? The deletion part is easy, but how to store it in such a way as to be able to restore it after it's been deleted is where I get stuck. I originally wanted to know so that I could bulk copy certain tables from one database into...

How to export all tables from an Access Database into Excel - A sheet for each table...

I have an Access database with ~30 tables. How can I export all 30 tables into separate sheets in an Excel workbook? I'm hoping to find some VBA/VBS code which I can run from within Access to accomplish this task. Any ideas? ...