access-vba

MS Access VBA call sub works on the first pass but not on the second

被刻印的时光 ゝ 提交于 2020-01-25 08:39:21
问题 I have hit a wall and I am completely at a loss. So I have a Form in MS Access. In it I have a single text box and a single button. When I type in a number in the text box and then click the button it opens a public sub which then runs a few queries, updates the database, displays a text box and then clears out the text box. This all works perfectly. My issue is trying to do the exact same thing with hitting enter in the text box. The strangest thing is that the code works fine right after I

Make fields visible in MS Access form as certain fields are completed

时光怂恿深爱的人放手 提交于 2020-01-25 08:08:21
问题 I am building a form In MS Access for users to input data but there are too many possible fields. Most of the time only about half the fields will be used. I thus would like to have certain fields appear only depending on what the user inputted on a prior given field. Ex: user enters project number, title, then he checks a "yes/no" engineering. since he checked it this means engineering is impacted so a dozen fields that the user will have to fill out appear. Is this possible: 1)without VBA 2

How to make a Public Function return SUM value based off current Month in ms access 2016

二次信任 提交于 2020-01-25 08:05:13
问题 I have this code that i am trying to use however when the query calls it it returns a blank column of data. so on it i am trying to add the number value in each column and adding a new column each month with the math formula. Option Explicit Public Function FCalcMnthALLTDISTRIB() Dim OCT As String Dim NOV As String Dim DEC As String Dim JAN As String Dim FEB As String Dim MAR As String Dim APR As String Dim MAY As String Dim JUN As String Dim JUL As String Dim AUG As String Dim SEP As String

Error 3421 Data Type Connection Error Multy Column Combobox

断了今生、忘了曾经 提交于 2020-01-25 06:57:07
问题 I have a scenario where in I have to save "STATUS" code into table from a "COMBO BOX". This Combo Box shows "Status ID" and "Status Description" together. But while saving I need to save only "Status ID" Following is the code for the complete form functionality. Error is occurring on click of "SAVE" button. On line where I am assigning the value from combo to "Recordset Column" on line # 77 or 90. ' rs![status_ID] = Me.cboStatus.Column(1) Option Compare Database Option Explicit Dim db As

How to automaticaly calculate a new field (Column) in MS Access DB 2016 each month

孤人 提交于 2020-01-25 06:38:09
问题 I'm using MS Access 2016 on a win10 platform. I have a table in Access tbl_OB_PLAN_ALLT_DISTRIB that has the months of the year as headers example: OCT , NOV , DEC , etc.. I have a query that calculates the total of the months dollar value for all my Organizations that money is sent to. I am needing help modifying my code in my query to automatically add the next month field to that calculation. I currently have to go in the query and modify it every month. Here is what I am using so far: OB

MS Access VBA parse XML File

心已入冬 提交于 2020-01-25 01:34:53
问题 I'm having a tough time here. I'm trying to import and parse an XML file with VBA. However, the .LoadXML function doesn't seem to be working. I've loaded the Microsoft XML, v6.0 reference and the XML file is valid. Here's a portion of the code: Public Function ParseXML(ByVal strXMLFilename As String) As Boolean Dim intFile As Integer Dim strXMLFile As String Dim xmlDoc As Object Dim xmlTransmission As Object 'MSXML2.IXMLDOMNode Dim xmlSurvey As Object 'MSXML2.IXMLDOMNode Dim xmlRecord As

Calling a UDF (Sql server) from VB Access “Undefined function <function name> in expression”

隐身守侯 提交于 2020-01-24 19:12:05
问题 I am trying to call a udf (SQL server) from Vb code in access. Connection to DB was successful and I am able to run queries on SQL server tables. However, when I try to call the UDF, it throws me an error saying undefined function . Please see the code below: Private Sub cmd_Login_Click() ' some code here Set db = CurrentDb() sSQL = "SELECT UserID FROM TBL_User_Login WHERE UserName = '" & cbo_User & "' AND Status = 0" Set recset = db.OpenRecordset(sSQL) recset.Close Set rectset = Nothing sSQL

Calling a UDF (Sql server) from VB Access “Undefined function <function name> in expression”

南笙酒味 提交于 2020-01-24 19:11:23
问题 I am trying to call a udf (SQL server) from Vb code in access. Connection to DB was successful and I am able to run queries on SQL server tables. However, when I try to call the UDF, it throws me an error saying undefined function . Please see the code below: Private Sub cmd_Login_Click() ' some code here Set db = CurrentDb() sSQL = "SELECT UserID FROM TBL_User_Login WHERE UserName = '" & cbo_User & "' AND Status = 0" Set recset = db.OpenRecordset(sSQL) recset.Close Set rectset = Nothing sSQL

Rounding dates to the day in an SQL query

给你一囗甜甜゛ 提交于 2020-01-24 18:24:23
问题 I am stuck with something. I am trying to take a long column of dates of which are formated to show also hours and minutes and run a Group query to paste values at the date level without acknowledging the differences in hours and minutes.. Unfortunately I have no clue how to start. The code i put together so far which returns each grouped date with the hour and minutes is as follows: st_sql = "INSERT INTO [tblSearchEngine03] ([Date])" & _ "SELECT [tblSearchEngine02].[Date]" & _ "FROM

How to search a field in a table in Access

橙三吉。 提交于 2020-01-23 15:04:08
问题 Using VBA, how can I search for a text string, for example "CHIR" , in a table called "ServiceYES" , in the field "Service" . After that, I would like to save the neighboring field for all the rows that "CHIR" exists in the table "ServicesYES" . The "ServiceYES" table is below: I basically, want to find all the "CHIR" in "Service" column and then save the names which are on the left of the CHIR, eg "FRANKL_L" , "SANTIA_D" as an array. Thanks for all your help in advance. 回答1: Start by