Answer Questions
Meteor73 Sum of hours using select statement & VBA
Hi - ok here is my question: I have an activity recording form that records hours logged against a company. I have added a field called 'sumactivityhours' to the table and the form. what i would like to do is when a user selects a company from the drop down list (thanks derek and duck thing for your fantastic help with that problem) it automatically populates the 'sumactivityhours' field with the total number of hours worked thus far with that company so that the user can see the total hours and then writes that information into the 'sumactivityhours' field in the table. as i gradually begin to learn a little more about VBA im guessing that i should create an on exit event on the companyname combo box that re ...Show All
Seddryck opc
I am trying to develop an opc - da client using .net technology. Have gone through the documents on opc and opc client and all, but am still not sure how to implement it, can someone give me a direction on how to start with it I was looking for some help developing a C# OPC client using the OPCAutomation wrapper when I stumbled upon your conversation. Here is a link to a VB.Net sample OPC client that helped shed some light on using .Net to develop OPC clients using the wrapper. http://www.kepware.com/Temp/Simple_VB_dot_Net_OPC.zip When i try add an Opc group, i get te following error message: Opc Server add group failed with exception: Unable to cast object of type 'Opc ...Show All
Will Sullivan Refer to another module
I have a small problem with a macro. I have two different moduls in my code. In module1 i have the code for some buttons and so and in module2 i have the code for what happens if i press the buttons. However my code has trouble finding the different modules and I need help on how to write this properly. Code in module1: Sub Create_Menu() Dim MyBar As CommandBar Dim MyPopup As CommandBarPopup Dim button1 As CommandBarButton ..... Set button1 = .Controls.Add(Type:=msoControlButton) With button1 .Caption = "Button!" .BeginGroup = True .OnAction = "button1_Click" and in modul2: Sub button1_Click() Dim objChart As ChartObject Now I need help with how to refer to the sub. My code is quite mes ...Show All
alwisha Method 'OnAction' of object 'CommandBarButton' Failed
One of the users is getting the following error message: Runtime Error '2147467259 (80004005)': Method 'OnAction' of object 'CommandBarButton' Failed. The following is the code: Private Sub Workbook_Open() Dim MyCommandBar As CommandBar Dim MyControl As CommandBarButton For Each MyCommandBar In Application.CommandBars If MyCommandBar.Visible = True Then If MyCommandBar.Name = "Worksheet Menu Bar" Then Set MyControl = MyCommandBar.Controls.Add(msoControlButton, , , , True) MyControl.Caption = "GFS BW Printing" MyControl.Style = msoButtonCaption MyControl.Visible = True MyControl.OnAction = "GFS_Printing_Macro" End If ...Show All
LpAngelRob How to declare activeX object in source code instead on the form?
Hi everyone, My questio is about VB6 ..... I want to declare a ActiveX object in the source instead of "drag and drop" a ActiveX object into the form. Let's say, I want to declare a timer dynamatically at run time, so I want a way to decalre a timer in the source. I found code from the other forums seem to do the job but it would not compile for me: Dim withevents my_timer as timer 'Or Private withevents my_timer as timer 'In form_load() set my_timer = new timer () <---- this line would not compile Any idea Thanks Kit http://www.developer.com/net/vb/article.php/1541411 this article talks about the similar technique I was trying to use... looks like that way of declaring activeX control is only ...Show All
percent20net SELECT syntax in VBA for retrieving information
Hi - this is coming as a modification from one of my previous posts that were solved - on an activity screen the user who is logged in can only select companies that have the 'active' tickbox ticked and where the 'leadofficer' value must equal the value of the user logged in. this is achieved by the following VBA Private Sub Form_Load() Me.companyname.RowSourceType = "Table/Query" Me.companyname.RowSource = "SELECT [companyname] FROM [tblcompany] WHERE [active] = Yes AND [leadofficer] ='" & loginname & "'" End Sub where loginname is a global variable held in a module and stores the name of the user currenty logged in. However i now need an additional leadofficer field - 'leadofficer2' which ...Show All
Amit V How do I create and use 3D ranges in Excel-VBA
It is easy to create and use 2D range in excel. The following code will do Option Explicit Sub Demo3DRange() Dim sh As Worksheet, r As Range, vData Dim Row As Integer, COl As Integer Set sh = ThisWorkbook.Sheets("Sheet1") Set r = sh.Range(sh.Cells(1, 1), sh.Cells(100, 2)) vData = r.Cells.Value For Row = 1 To 100 For COl = 1 To 2 Debug.Print vData(Row, COl) Next COl Next Row End Sub When we execute the above code, the variant vData will become a 2D array of 100*2. Now my question is following: A)How do I create a 3D range in VBA code B)Can I assign that 3D range to a variant, and get a 3D array, just as I get 2D array in case of 2D range Thanks -Rahul ...Show All
TheFreeman iexplore.exe does not respond
Hi: I just got a new desktop and ie7 was installed when running windows update. It didn't work well and I decided to uninstall it. ie6 was back. However, ie6 now slows the pc significantly. When I close ie6, I can still see iexplore.exe running in the task manager. Plus, when I want to turn off the computer, it says that iexplore.exe doesn't respond and I have to press "End now" 2 to 3 times to be able to turn off the computer. The behavior that I just described does not happen every time I run ie6 (i.e.: iexplore.exe is not running in the task manager after I close ie6). I will say the problem happens 50% of the time. Any clues to what is going on Or how can I fix it Thanks for your help! Herman ...Show All
MRDPrince Worksheet.Copy causes execution to stop
Hi I am experiencing an odd behaviour from my VBA code in Excel. I have some code that has worked until recently. We have gotten XP instead of win2k, which i could suspect is causing this in some strange way. My problem is that i have the code below. In the line where i say Worksheet.Copy, the execution simply stops. No errors appears, nothing. <CODE> On Error GoTo ERROR: Worksheets(SN_MonthYearAct).Copy After:=Worksheets(Worksheet.Count) .... ERROR: MsgBox(Err.Description) </CODE> The variable SN_MonthYearAct is a constant containing the string "MonthYear Act", and a sheet with this name does exist. Worksheet.Count returns currently 8, and there are 8 sheets in the workbook. I have trie ...Show All
Prashanth Desai How can I give my own Error handling a higher priority
Hello everyone, i want to give the user of my program some hints when an error occurs. I tried to create an active Error handling (Code below). But Visio always opens its own typical window instead of doing the actions I want it to do. Is there any reason why <code> On Error goto Error_Handle 'Some Code including: Err.Raise(6) Err_Handle: 'Some actions </code> thanks :) ...Show All
Summa automatical start macro in access2003
I develop system from MS Access Ver.2003 when user open this file MS Access 2003 will show msg security warring . I want to code for using automatical start macro in access2003 help me please. Thank hi, best way is to use a splash screen (form) for the database that is set as the startup form. In the form you can place any code you like and if you have a switchboard then make sure your splash screen loads your switchboard before it closes. The security warning will remain and requires you to reduce your security permissions for your macros or you need to sign your project. Hello, If you name any macro "autoexec" it will execute on start up. Is this what you are looking ...Show All
l33t Using arrows to select in drop down list in access
Hi - anyone know how to get a drop down list combo box to allow you to select an option using the up/down arrows on the keyboard in access rather than having to click on the down arrow on the combo box in access - user wants to do it by tabbing into boxes and using the arrows to select because its quicker. thanks, Rhys. Hi, To display the dropdown part use ALT+Down Fussy users, surely not. Try this, dropdown appears on down arrow. Test also allows normal use of ALT+Down Private Sub ComboBox1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyDown And Shift <> acAltMask Then ComboBox1.Dropdown End If End Sub Hi Andy, thanks that helps but i would like users ...Show All
ocelot663 Sum of hours using select statement & VBA
Hi - ok here is my question: I have an activity recording form that records hours logged against a company. I have added a field called 'sumactivityhours' to the table and the form. what i would like to do is when a user selects a company from the drop down list (thanks derek and duck thing for your fantastic help with that problem) it automatically populates the 'sumactivityhours' field with the total number of hours worked thus far with that company so that the user can see the total hours and then writes that information into the 'sumactivityhours' field in the table. as i gradually begin to learn a little more about VBA im guessing that i should create an on exit event on the companyname combo box that re ...Show All
Cosmin Nicolaescu Edit DataLabel in Excel charts
Hi all, I wonder have I can add a Legend Key(a line that goes from the point in the chart to DataLabel text) to the DataLabel in the code below I would also like to now how I can change the position of the DataLabel. With ActiveChart With .SeriesCollection(1).Points(2) .HasDataLabel = True .DataLabel.Text = "Saturday" End With End With Thankful for tips. Jonas Thanks Andy! Maybe this example of leader lines will help. http://www.andypope.info/ngs/ng14.htm To change the position of the data label you can use code like this. ' using built in label positions. Positions available depend on chart ...Show All
Redburga Object Browser
I find the object browser very useful for finding out what objects are available to me. However, it would be more useful if I new what the small symbols or icons denote just to the left of each object/class (e.g. an easy one to describe would be a hand holding what looks like a card and another a green object with what looks like motion lines coming off of it). Would anyone who knows what I am referring to be able to list what they mean Cheers! That's most helpful. Thankyou very much! No worries Keithyboy, The grey square with the red, green and yellow blocks on it is a class. (i.e. Application) The green moving thing represents a method of the class (i.e. A ...Show All
