Questions tagged [vba]

Visual Basic for Applications (VBA) is an event-driven, object-oriented programming language for writing macros, used for the entire Office suite as well as other applications. Questions with this tag should restrict themselves to specific interactions with the database platform. Broader VBA programming questions should be asked on stackoverflow.

Filter by
Sorted by
Tagged with
2 votes
2 answers
158 views

SQL Server: Trigger with UPDATE statement causes deadlocks

I have added a trigger to perform a change tracking mechanism on a table that has a relatively high load. During testing, we encountered no issues but now as it is in production there are deadlocks ...
JannikB's user avatar
  • 21
0 votes
2 answers
111 views

How to send an access database

I’m having trouble trying to find a way to send a ms access application to someone I have built one for. They say you cannot open it from OneDrive or problems occur. But is the person able to copy it ...
CShane13's user avatar
0 votes
1 answer
518 views

Anything but small ODBC queries failing over long distance VPN after SQL Server Swap

I recently swapped database servers (restored databases from old to new and then swapped IPs)... Old: Sql Server 2005, Windows Server 2003 New: Sql Server 2008, Windows Server 2012 All processes ...
MrVimes's user avatar
  • 629
0 votes
1 answer
407 views

VBA - Hide a Form tab depending on the value of a field

pretty simple question here in scope. Question: Wondering If I would be able to hide the tabs of a form based off the values of a table's fields. I have been reading the 2019 Access Bible and so far ...
Brandon G's user avatar
0 votes
1 answer
162 views

How to split one column into two using different tables?

I am developing a frontend application in VBA, which is linked to an Oracle database. In Oracle there are the two tables Table1and Table2, which are related to each other by expTypeID and measID: ...
JAUGRY's user avatar
  • 3
1 vote
1 answer
230 views

MS-Access Beginner Replace Textbox Caption With Combo Box Selection on Button Press [closed]

I'm a complete beginner, just trying out/looking into Databases as more of a hobby, and think Microsoft Access would be an easy way to start with the whole front-end forms and back-end combination. I ...
SamuraiMelon's user avatar
0 votes
1 answer
579 views

How to save Outlook attachment in a drive with a new name and overwrite if it already exists? [closed]

I am using below VBA script to download attachments from email and save it to my windows directory. I need help to modify this script - 1) to save rename the attachment before saving it 2) Overwrite ...
Andleeb Hasan's user avatar
1 vote
1 answer
920 views

How to refer to Field Name with a ? in it in MS Access VBA code [closed]

Simple question, but I am new to databases. I have a field called 'ActorRetired?', and in some VBA code I need to set the value of it to -1. But When I try: Me.ActorRetired?.Value = -1 I get the ...
Amber Cahill's user avatar
0 votes
1 answer
2k views

CopyFromRecordset Not Working

Hi I Inserted A Select MaxID+1 Data and want to retrieve what was that ID I inserted the Following is the codes Im trying to Insert data from Excel to Ms Access and Automatically Retrieve that Data. ...
WIL's user avatar
  • 1
0 votes
1 answer
144 views

Cannot login to a MS Access database

Below is some VBA code to authorize users to login into an MS Access database. I am trying to fix this code and I don’t understand what is the issue in this code snippet. Private Sub cmdLogin_Click() ...
KCR's user avatar
  • 7
0 votes
0 answers
153 views

how Access can communicate to SQL without using ODBC?

Access will be the front end but I don't want to use ODBC on everyone's PC. Do you have any suggestions on how Access can communicate to SQL without using ODBC?
Supreet Kaur Sidhu's user avatar
0 votes
0 answers
1k views

How to troublshoot updating to MSOLEDBSQL driver that is breaking macro-enabled Excel book?

I have an Excel macro-enabled file (.xlsm) with VBA that builds various SELECT statements and also executes a stored procedure on a SQL Server DB in order to populate a table. It is from a legacy ...
hap76's user avatar
  • 15
0 votes
2 answers
64 views

Best way to enter data in DB that is spread out date wise

I have an Excel file that, to keep it simple here, has 3 columns: ActivityID, ActivityName and TotalHours. TotalHours column is basically all the hours allotted to that specific ActivityID and the ...
AutoMate's user avatar
1 vote
0 answers
24 views

Modeling a system with optional components

I am working on an MS Access database that is intended to help keep track of a large scale implementation of many component parts connected together. I have created a working implementation based on ...
Jemimacakes's user avatar
0 votes
2 answers
107 views

Get value from one field, and paste it in to a new column

I'm relatively new to Microsoft Access, and just a beginner with SQL programming. I have a table in MS Access. It is an import from a .txt file. In the first column There is a String with a Number or ...
Neymar0001's user avatar
0 votes
1 answer
3k views

How can I setup and use a PostgreSQL database without installing a driver?

I have a portable PostgreSQL database that runs perfectly on my computer as a database server. This is a work computer that I use for a lot of work in Excel with non-sensitive data (that is, data that ...
user182399's user avatar
0 votes
1 answer
66 views

Visual Studio extract database values to excel with header text!

I am trying to extract the values from an mdf database to excel, but i can't display the header texts(title fields). I can only view the values. In order to make this work i need a query like this ...
Paulos Xampos's user avatar
1 vote
1 answer
123 views

SQL how to remove duplicate results from same table

I created an sql table on visual studio for visual basic, where i can put dynamic data every time i click on a button. I get the table results from textboxes and one datagridview with values(quantity,...
Paulos Xampos's user avatar
0 votes
2 answers
1k views

Concurrent connections to the same table

We are a small firm, with about 10 people using a database server. I have this application that connects to a database and fills about 40 rows of data in an table. Then calls a stored procedure to ...
Anirban's user avatar
  • 23
2 votes
1 answer
333 views

Access: Number format for VBA in queries of variant type

Lets say I have two queries like select iif(condition, col, null) from table select f(col) from table where col is a double-valued column f is a VBA-public function(value as double) as variant. ...
Bubaya's user avatar
  • 155
3 votes
3 answers
27k views

How to compact the current MS Access database from VBA function

I want to be able to run the 'compact and repair' process from within a VBA module in the database. I have a batch process that I run occasionally, it drops a few old tables, re-imports them from ...
ConanTheGerbil's user avatar
1 vote
1 answer
64 views

Inserting ID and Date to locate data for C#/VBA application

I am trying to allow users to upload an excel sheet to insert data into the sql database. When they upload data I want a datagrid view to show the data they just uploaded in the database and to be ...
SQLserving's user avatar
1 vote
0 answers
627 views

Using VBA to open Access in full screen and in foreground

I have 2 issues. I am using VBA code to create a macro in PPT that opens an Access report. The macro works but does not open it in full screen. I have tried to add the DoCmd.maximize but not sure ...
Jeff's user avatar
  • 11
0 votes
1 answer
383 views

After running VBA, I lose exclusive access to the database

I wrote some VBA to import an excel spreadsheet easily into a table in my database. This way, the user just clicks a button on a form, and answers some questions about the file to be imported. The ...
MGaddict's user avatar
1 vote
3 answers
1k views

Transfer datas from Access to PostgreSQL

I'm trying to insert some data from Access to PostgreSQL database, but it's not a simple query, because it's a nested query. For example : rst.Open "INSERT INTO car(id, model, color, type) SELECT (...
user120533's user avatar
1 vote
1 answer
8k views

How to minimize full ms-access window in vba? [closed]

I have some code to minimize like docmd.minimize but it does not work. Please let me know how to minimize whole window of access in vba?
user1915069's user avatar
3 votes
2 answers
2k views

PostgreSQL: alternative ways to connect to database

THIS IS A THEORETICAL QUESTION. I am posting it on this site because of this and because I think that database administrators could provide more accurate insight. The line that separates the two sites ...
Feillen's user avatar
  • 191
0 votes
1 answer
3k views

vba Excel data Validation error 'Application-defined or object-defined error'

I've read loads of similar questions and answers, but keep getting error. What I do is I export query via DoCmd.TransferSpreadsheet acExport, 8, "blabla", outputFile, True Then I'm attempting to ...
Choper's user avatar
  • 11
0 votes
1 answer
142 views

ms-access: issues with form and subform interaction

There is a main form bound to the main table, public_OUT_Detalle_PMC. And there is a form bound to a smaller table, public_ficha_negocio, which is a selection of fields in the bigger table. This ...
Feillen's user avatar
  • 191
1 vote
0 answers
421 views

Access-PostgreSQL: Link tables as readonly, edit registers in form

I have a PostgreSQL database working as backend and I have to develop an Access frontend solution for regular users of this database. I decided it best to create some forms to manage the input, ...
Feillen's user avatar
  • 191
1 vote
1 answer
2k views

MySQL/MariaDB connection in asp code encodes wrongly charset utf8 at insert or update in data base

I can't get a simple update or insert to save special äöü characters. Instead they are being stored as äöü. The website displays äöü characters correctly if they are already stored as äöü in the ...
MeSo2's user avatar
  • 133
0 votes
1 answer
18 views

On Load sub which checks records causing problems

I have a checkbox called 'Added to Schedule' on a form (booking sheet) which is supposed to be ticked if the job appears on another table (schedule). It usually works but sometimes if the job is then ...
TCassa's user avatar
  • 133
3 votes
3 answers
10k views

Access 2010-2016 Compatibility Error

I was just updated to Access 2016, while my users are still at Access 2010. I opened our database in MS Access 2016 once, didn't make any changes, and closed it out, and now all the users are having ...
pblo's user avatar
  • 31
1 vote
1 answer
2k views

ADO connection suddenly starts failing Intermittently

I have an Access 2010 front end connecting to a SQL Server 2014 back end. I've got SSMS 2014 installed on my machine, and everything was working fine. (Running Win7 64-bit with 64-bit Office.) Long ...
FreeMan's user avatar
  • 221
5 votes
3 answers
3k views

is automated data movement via Excel considered ETL?

I am wondering if informal methods of automatically extracting, transforming, and loaded data constitute "ETL." For example, I code Excel VBA to extract from databases onto a spreadsheet, transform ...
brietsparks's user avatar
1 vote
1 answer
3k views

Automatic creation of unique Alphanumeric ID?

All the accounts in my database have a unique ID, that begins with the letter "G" (always), and has a 3 digit number following (e.g. "G026", "G123","G005","G999", etc.) When a user is inputting new-...
jotakah's user avatar
  • 13
1 vote
1 answer
52 views

Query Access Question

With one table tblBids containing BidId field with the relationship bidID has multiple contractors from tblContractors, I am trying to create a query which will list each contractor and email address ...
Joseph Chang Nutter's user avatar
3 votes
2 answers
7k views

Best design for a tree-like structure database

I'm designing a database in MS Access which is used for tracking the locations of a variety of chemical solutions, made in batches. Each batch can be split (aliquoted) practically indefinitely. That ...
Mark Butler's user avatar
2 votes
2 answers
1k views

Splitting 1 record on one table to become two records on another table

I am REALLY very new to this so please excuse my ignorance, but I could really use some help! I've got two tables: BillsFiled and Authors On BillsFiled, there are the columns: ID, Symbol, Filedate, ...
Glen Cullen's user avatar
0 votes
1 answer
817 views

Which version of VB does MS Access use?

Which version of VB does MS Access use in the code editor? Is it VBA, VB.Net, other? I sometimes get confused when searching for help/solutions. For instance, in Access, you can't do: Dim s as ...
abalter's user avatar
  • 127
1 vote
1 answer
3k views

MS Access query-by-form opening query, but not running it with new form data

I have created a query-by-form in MS Access. The form has a text field for each field in my table. I'm only using one starting out to test. The query criteria for that field is Like "*" & [Forms]...
abalter's user avatar
  • 127
0 votes
2 answers
908 views

How do I translate this query from MS Access into SQL Server

How do I translate this into SQL Server: select -Sum((12=[GroupNum])*[BoardStatus]) AS G12 FROM QryAllBoardsByPacketIDs INNER JOIN tBsReportGroups ON QryAllBoardsByPacketIDs....
user1124937's user avatar
1 vote
1 answer
2k views

VBA @ Access on replacing values on a huge list

I have a question (that's why I'm here actually :P ) about VBA @ MS Access. So, I have a huge database (well, for me it is huge, about 23K+ ID) on shoes. It has 5 columns: ID, Article number, size (...
Looking_for_guidance's user avatar
-1 votes
1 answer
52 views

Grouped Data tracking [closed]

I have a MS Access Database that tracks clients, client regions and transaction types. Users are keying in transactions and once done, the system needs to create letters to the client regions ...
Avagut's user avatar
  • 111
1 vote
1 answer
911 views

Calculating Open Days field and stopping with status change

I had a question but wasn't sure where I needed to post or view if someone has done this before. I have a dilemma on my hands. Background Info: I have been trying to figure out what to do since I ...
PPK's user avatar
  • 11
3 votes
3 answers
20k views

VBA Maximize Access Application Main Window

I need my access application window to open up in full screen. I have tried using: DoCmd.RunCommand acCmdAppMaximize and DoCmd.Maximize (which I think only maximizes a Form). Neither is working ...
Juan Velez's user avatar
  • 3,255
3 votes
2 answers
1k views

Rearranging Data in an MS Access 2007 table into a new table format/Result Output

I have Access tables that have the following format: -------------------------------------- |Name |Math|Science|Reading|Civics| -------------------------------------- |Mike | A | C | A | B ...
Juan Velez's user avatar
  • 3,255