I have a piece of VB code that dynamically finds my current file path in Excel. Now I wish to use it when importing text from a text file, but can't figure out just how to code it.
Here is my code for getting the current path:
Function GetCurDir()
Dim str As String
Dim pos As Integer
str = ActiveWorkbook.FullName
pos = InStrRev(str, "\...
I want to get the name of user who have logged-in ,in the access vba. What is the best way to get it
Duplicates of this question:
Is there a way for MS Access to grab the current Active Directory user?
Using VB6, how do I get the current user and domain on Windows XP?
How can I get the currently logged-in windows user in Access VBA?...
I have a set of ComboBox's in an MS Access 2003 DB that are all bound to fields in a single table. However, the data that they allow you to select doesn't come from that table and instead comes from various other tables. This works fine for the record creation story but now I want to be able to edit the record retroactively. The probl...
I'm debugging the following code in an Excel 2007 VBA, which seems very simple. For some reason its taking about 30 minutes to process 900 rows of data. I think I have narrowed it down to some cell formatting, specifically the WrapText option. Is there something I'm missing here that can increase the performance when deleting these ro...
Hi everybody,
I have a Workbook with three WorkSheets: Product , Customer, Journal.
What I need is a macro assigned to a button within each one of the above Sheets.
If the button is clicked by the user, then the active sheet should be saved as a new workbook with the following naming convention:
SheetName_ContentofCellB3_DD.MM.YYYY
wh...
This seems like it would be a simple affair, and I am sure I have done this before, but it has been a while since I have done any UI programming in Access. What I need to do is put a button on a form to toggle between datasheet and form view for a subform.
I have found a defaultview property, but nothing that looks like it would toggle ...
This should be easy but for some reason it will not work. I have a form named MainForm and the selection in the Option Group I want to select is called PickMe.
I have a text box called TxtHere that I set to not be visible.
I wrote this:
Private Sub PickMe_Click()
Me!TxtHere.Visible = True
End Sub
So it should set the text box to...
I have an MS Access 2003 database that I'm using to develop a basic little inventory app. I have added some extraneous forms along the way and I wanted to get them out of the DB. I deleted most of them just fine but one of them appears to have left behind its VBA Object. All that's in the object is Option Compare Database. Now whenev...
Would It be possible to see Stack in VBA (MS Access 2003). I mean Would it be possible to see what procedure or function this function was called from...
...
So I have a few Queries already written and my goal is to have a user input certain fields that would change the way the Query is returned, basically having the user change 2 or 3 parameters of the original Query.
First, I'm having problems getting a Query to execute in VBA:
Private Sub QResultButton_Click()
DoCmd.OpenQuery (Readings200...
Anyone have any suggestions for good books or even links? I was tasked with writing some things at work and they insist on using VBA and I am not very familiar with it.
EDIT
Identical to:
http://stackoverflow.com/questions/483086/book-recommendation-for-visual-basic
Except this is visual basic and not VBA which are different. And the...
I'm trying to create a QueryTable in an excel spreadsheet using the Python comtypes library, but getting a rather uninformative error...
In vba (in a module within the workbook), the following code works fine:
Sub CreateQuery()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim ws As Worksheet
Dim qt As QueryTabl...
I have a table (readings) already connected by ODBC in Access that opens very quickly when I click on it.
However, when I try to run this in VBA I it locks up and never displays anything:
Dim strSql As String
strSql = "SELECT readings.ids " & _
"INTO ids_temp " & _
"FROM readings " & _
"WHERE readings.ids > 12...
Introduction
I can't seem to get the the ChartObjects.CopyPicture method to work in Excel 2007. No matter what I try I get an error.
Using this technique throws an 'Application-defined or object-defined error' on the CopyPicture line.
ActiveSheet.ChartObjects.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Sheets("Sheet2").Paste
...
I have a two dimensional table with countries and years in Excel. eg.
1961 1962 1963 1964
USA a x g y
France u e h a
Germany o x n p
I'd like to "flatten" it, such that I have Country in the first col, Yea...
I have the following worksheet #1 (simplified for the question) of person and age:
Person Age
Bob 40
Brett 35
Brian 38
I would like to setup another worksheet where I have the following:
Person Age
Spot #1 FORMULA
The user will enter a name in Spot #1 and I want a formula/code in the cell titled FORMULA where t...
is it possible? I couldn't find any code that does that.
...
What is the best way to check is access form is open and get the value of textbox using Excel VBA.
I mean is there a way to check if MS Access application is running and if it is then check certain form is open then get the value from this form's textbox field.
Something like
If MSAccess.([Application name]).Forms("FormName").isOpen...
This is a Query in VBA (Access 2007)
I have 3 strings defined:
str_a = "db.col1 = 5"
str_b = " and db.col2 = 123"
str_c = " and db.col3 = 42"
Then I use these in the WHERE part of my Query:
"WHERE '" & str_a & "' '" & str_b & "' '" & str_c & "' ;"
This fails, but If I paste in the strings like this:
"WHERE db.col1 = 5 and db.col2 ...