vba

Connecting Excel to Mysql Update PROBLEM

i am connecting to a mysql table through vba in excel and i am updating it: Set cn = New ADODB.Connection cn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _ "SERVER=localhost;" & _ "DATABASE=employees;" & _ "USER=root;" & _ "PASSWORD=M1llen;" & _ "Option=3" 'lets get the batch info ' ' open a recordset Set rs = New ADODB....

what does rs.Fields(0) mean? (ADODB) VBA

dim rs As ADODB.Recordset ... ... ... capture_id = rs.Fields(0) what does .Fields(0) mean? ...

Do sfSubForm.fForm.RecordSource and Forms(fForm).RecordSource refer to the same object and property?

Hi, this has me pretty confused and I can't find the answer anywhere else so thought I'd post here to see if anyone can help! I have a form in an Access 2007 database with a subform (sfSubform) embedded in it. The subform control's SourceObject is set to be another form (fForm). fForm's RecordSource starts out as a table. At one poin...

How to compact an MS Access database, while the database is open, using vba

I am running a few modules of VBA code. In the middle of running the code crashes as Access reaches its max size of 2GB; but, if I compress the database at that point it is only 200MB. Is it possible to compress the database at regular intervals while the code is running? ...

Problems getting PowerPoint Combobox to list items correctly

I am creating a PowerPoint in which I want users to be able to select an item from a list in a combo box. Nothing needs to happen after this, it is just to provide a record, on screen, of their choice. My problem is that I seem to either be able to populate the combo box and users can select an item but the list gets longer each time th...

adodb .FIND question

i am using excel to connect to a mysql database i am doing this: rs.Find "rowid='105'" If Not rs.EOF Then cn.Execute "delete from batchinfo where rowid='105'" and it works well however, i need to be able to match data on multiple columns for example like this: rs. find "rowid='105'" and "something='sometext'" and "somethingelse='m...

invalid use of rs.filter property?

i am connecting to mysql using adodb from excel i am doing: dpath = Range("B2").Text atime = Trim(Range("B3").Text) rtime = Trim(Range("B4").Text) lcalib = Trim(Range("B5").Text) aname = Trim(Range("B6").Text) rname = Trim(Range("B7").Text) bstate = Trim(Range("B8").Text) rs.Filter "datapath=dpath and analystname=aname and reportname...

displaying multiple values with .FIELDS adodb

i am getting some data: rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "' and batchstate='" + bstate + "'" If Not rs.EOF Then MsgBox rs.Fields("rowid") End If if the rs.filter returns multiple records, how do i get rs.fields("rowid") to give me multiple rowid values? ...

ms-access: displaying column as "something else"

i have the following access sql statement: SELECT * FROM (SELECT [Occurrence Number], [Occurrence Date], [1 0 Preanalytical (Before Testing)], [Cup Type], NULL as '2 0 Analytical (Testing Phase)', [2 0 Area], NULL,NULL FROM [Lab Occurrence Form] WHERE NOT ([1 0 Preanalytical (Before Testing)] IS NULL) in this: NULL as '2 0 Analytical...

ms-access the ability to enter multiple values into a textbox on a form

i have a textbox on a form and i would like the user to be able to choose from different values but also be able to enter their own values, how do i do this? i would like to clarify that the user should be able to enter multiple values into the same textbox ...

ms-access: clear text in all controls with one click

i have some comboboxes and some textboxes on a form i would like to clear all of them with one line of code. is that possible? something like all_controls.text="" ...

How to run a query from the VBA Editor window in Access?

I would like to do something like this: DoCmd.OpenQuery "select * from some_table;" How would I do this? Please keep in mind I don't want to create a new query, save it, and run it. I just want to type the select statement in the VBA code and run it. ...

How to run a query and put the result into a variable

I am running a query from the VBA editor of Access: select max(somerow) from sometable I want to put the result of this query into a VBA variable. How do i do it? ...

MS Excel automation without macros in the generated reports. Any thoughts?

Hello! I know that the web is full of questions like this one, but I still haven't been able to apply the answers I can find to my situation. I realize there is VBA, but I always disliked having the program/macro living inside the Excel file, with the resulting bloat, security warnings, etc. I'm thinking along the lines of a VBScript th...

How to Add Icon to a Excel Menu/Toolbar Button

Hi, I need to add a image to a custom toolbar/menu item which is create through VBA. For a toolbar item, I tried following code Set NewBtn = TBar.Controls.Add(Type:=msoControlButton) With NewBtn .Picture = LoadPicture("mypic.bmp") .OnAction = "'MyFunction""" & para1 & """'" //VBA Function '.Caption = "MyFunction" .TooltipText = "MyF...

access: passing variables from vba to sql

i am clicking a button on a form in access: Private Sub Command29_Click() some_variable = 2 stDocName = "test" DoCmd.OpenQuery stDocName End Sub my query looks like this: SELECT * FROM [some_table] WHERE [Occurrence Number]=some_variable; is this possible to do? ...

distinction between using .text and .value in VBA access

i am passing the textbox1.text values into a query and sometimes into a string sometimes i say this: dim combor1 as string combor1 = comboReason1.Text how do i know when i should put combor1=comboreason1.value ?? also why do i need to set focus for a control to reference its property? that doesn't make sense to me also when i set ...

passing combobox value into sql query MS ACCESS

i have a combobox on a form i want the text of the combobox to be passed into a query. my query is: select..from..where something=[Forms]![Enter Data]![comboCup] the form name is enter data and the combobox name is combocup. should i do: [Forms]![Enter Data]![comboCup]![text] or [Forms]![Enter Data]![comboCup]![value] ?? ...

how to check if a combobox is empty without setfocus?

i need to know if any text has been entered into a combobox if i do: If comboReason1.Value <> "" Then it gives me an error, and if i do: If comboReason1.Value <> Null then this doesn't work. how do i check whether text has been entered into the combobox? ...

is it possible to make an EXE out of an access form?

i would like the user to think he's using a regular winform, but in the backend i want to have access handle the DB stuff. is it possible to just use the access form and have everything else disappear in the background? can we make an exe out of the form? what is MDE? ...