vba

Access VBA - relative file references

Hi, In have built a couple of mda library files which I am then referencing from my main Access application (i.e. using Tools -> References from within the IDE). Is there a way that these references can be made relative rather than absolute. The reason I am asking is so that it would make it easy to set-up on the user's computer if all...

Proper way to check if an unbound control has a value

Simple scenario: a form and one text box (unbound), Text1. If "" <> Text1 Then MsgBox "Not Empty" End If The above code works. The expression ""<> Text1 evaluates to True if the text box contain characters. The opposite doesn't work, regardless of the text box is empty or not: If "" = Text1 Then ' or alternatively, False = ("...

MSSOAP30 Object error: 0x80004002: Interface does not exist (VB)

Hi I'm well and truly stuck with MS SOAP 3.0, which I'm currently running from VBA Excel in Office 2003. I have used MS SOAP Toolkit 3 to create a proxy class which I am using. If I don't use it, I don't get the error, but then I'd have to write out the entire proxy class by hand and it's massive. When my program is first run, I get "C...

Connect to Excel with ADO - don't know Sheet Names

Hi, I'm connecting to Excel with ADO, but it only works if I specify the sheet names. I won't know those at runtime. Is there any method to get the sheet names? Excel automation? Thanks. ...

Ms Access Comparing two recordsets

Hi, I am trying to compare two recordsets. the first rs1 has random records. The second rs2 has the standard values for those records. Initially I am looking to take each of the records and see if they match with the standard set of values in the second recordset. There are four fields in each record set to be compared and all four must...

How to know if the VBA component of Office is installed?

My Excel addin requires the Visual Basic for Applications option of Excel to be installed in order for it to work. I would like my install (which is written with InnoSetup) to be able to detect if VBA is installed and warn the user if it is not. How can I detect if the option is already installed? ...

MS VBA and XPath 2.0

Do any VBA libraries exist which will allow me to use XPath 2.0 within VBA? MSXML6 does not work with XPath 2.0. Basically, I want to parse XML documents using XPath 2.0 as it allows me to use functions within the XPath expression to filter the XML document. As an example, the usage of the function current-date() would be useful as I w...

VBA - populating collection with arrays

hi i have the foll. code in VBA: Dim A As Collection Set A = New Collection Dim Arr2(15, 5) Arr2(1,1) = 0 .... A.Add (Arr2) can you tell me how to access the Arr2 through A? For example i want to do the following A.Item(1) (1,1) = 15 so the above would change ...

HTML editor control for use in MS Access forms

Can you suggest a free/bundled HTML editor control for use in MS Access forms? Basically I need to bind a control with a VARCHAR field that allows basic HTML input, formatting and preview functionality -- a WYSIWYG editor. ...

How to check the State of a Access 2003 Form, Modal or Modeless?

For a Project running under Access 2003 I have a Form that is normally set modeless, but in some cases is opened as acDialog and thusly modal. This Form now needs to check if itself is Modal or not to modify its behaviour upon button-click accordingly. Me.Form.Modal only returns the Property-Value specified in Design-mode, not the c...

With VBA, how do I close an Excel workbook without closing all workbooks?

Using Access VBA, I want to open an XL file, do stuff, then close it without closing other XL files that are open. Option 1: If the last line is "ObjXL.Application.Quit", that closes ALL open Excel files, not just the current one. Option 2: If the last line is "ObjXL.Close", then the workbook closes, but that particular instance of XL ...

How do you format text/strings in VBA?

In the code below, I take some input parameters, either text or a cell, and combine them to form one string using the formatting I need. I need to make Task_Name bold, as well as text like "Lead :". I know you cannot make text in a variable bold, but how do I go about this? This cell I'm storing the value in is eventually used in a Wo...

Limit number of selections in a MultiSelect ListBox in Access?

Is there a way to limit the number of selections a user can choose on a ListBox with MultiSelect enabled in Access 2003? Right now I have a procedure that fires on the On Click event that checks the number of choices selected and if it is over my threshold it will display a warning label. ...

From Access to Outlook Email and Back Again

I'm trying to set up a form where the user can click on a button and it pulls the email address of a contact, creates a new email, allows the user to type out their email and send it, then save the email into a table. I have it working, except for one little issue. In earlier versions of Outlook (2003 and earlier), you can set up Word a...

VBA data type error - bad syntax?

Hopefully someone can help me out with this. I have written a query in Access 2003 that combines a linked table "taxon_group_max_per_site" and a cross tab query "Distinct Species by group_Crosstab". From the table I have the field "Taxonomic Group" and "Max", and from the cross tab the fields "Total_Of_Species_S". The table and the cro...

VB Using colons to put two statements on same line

Is it considered bad practice to use colons to put two statements on the same line? ...

VBA Error "Bubble Up"

I haven't read much about it, but the author at the link below recommends that I don't use "bubble up" to centralize error handling in VBA. http://bit.ly/k2WJW (↑ Excel Programming Weekend Crash Course via Google Books) But I'm not sure why he recommends that, and he doesn't really explain. Can someone tell me why I should put error ...

Is there an Excel macro that checks that every row has a unique or blank number

What is an Excel macro that will check every cell in column A for whether they have unique numbers or are blank? ...

how to delete all DB rows via OpenRecordset (DAO)

How to delete all rows from table before starting inserting them? ...

Addnew does not add row when similar row there

I have a problem that adding ( overwriting existing 123 key) does not work, how to force updating a row if conflict occurs? db.OpenRecordset("table1", dbOpenTable) .AddNew ' create a new record .Fields("key") = "123" .Update ' stores the new record code works when DB does not have key 123 yet ...