access-vba

Access VBA, unescaped single quotes, Replace(), and null

隐身守侯 提交于 2019-12-13 05:18:50
问题 Working on a script in Microsoft VBA to take a massive flat database and split it between about 20 different tables. The script consists mainly of opening a table, checking every row in the flat database to make sure it's not a duplicate, then adding the necessary fields. Repeat for every table. The first time I ran it everything was going well until I tried to process the name O'Malley . I think it's obvious what went wrong. A quick search on Google turned up this related StackOverflow post.

How to create a comment box with time and date stamp in Access

随声附和 提交于 2019-12-13 05:17:26
问题 There's a template in Access 2010 called Contacts. On the form there's a comment box, a text box below it and a button. When you enter text into the text box and click the button it adds the text to the comment box and time/date stamps it. If you do it again it preserves the old text in the comment box and adds the new text below it. I'm pretty new to access, but I would like to be able to add this feature to my database. So I've got a Memo field on the table and form and an input text box

EASY: vba: Looking through a listbox and selecting the contents

流过昼夜 提交于 2019-12-13 05:16:49
问题 I know this is something really simple and it's slipping my mine right now. how do I loop though a listbox and select the contents? Here's the code I've made right now: Dim allGrps As Integer Dim i As Integer allGrps = lstAllGroups.ListCount For i = 1 To allGrps lstAllGroups Next 回答1: Keep in mind that the listbox is zero-indexed so you've got to subtract one off from i: For i = 1 To allGrps lstAllGroups.Selected(i - 1) = True Next i Also, make sure you've got SelectSheetsList.MultiSelect =

VBA (Access 2016) UPDATE Query

梦想的初衷 提交于 2019-12-13 05:12:25
问题 I've run into a problem with using a variable in a SQL Update Query in Access 2016. I have a logic field that will get updated based on a previously defined logic. In this example, Package_Status is a Yes/No logic field in TableName. This works: strSQL ="UPDATE TableName SET [Package_Status] = TRUE" dbName.Execute strSQL This does NOT work: xlogic = True strSQL = "UPDATE TableName SET [Package_Status] = '" & xlogic & "'" dbName.Execute strSQL I'm sure the reason is obvious but I'm stumped!

Combine Access fields into one field given two queries

十年热恋 提交于 2019-12-13 05:06:31
问题 I have n MS Access fields that needs checking per row for one legal cell. A legal cell simply does not have the values "missing", "unknown"; or is not blank. All of these cells will be combined into a single field that only contains cell with legal values. Referring to the table below, Name_Final will contain these legal cells from Name_2010 , Name_2011 and Name_2012 . I already have two separate queries to help me do the job but I need to combine their results in order for me to get the Name

Check to see if 8 comboboxes contain values that match one another excluding null

非 Y 不嫁゛ 提交于 2019-12-13 04:50:19
问题 How do I check to see if any of my 8 comboboxes match one another all at once (excluding null values of course, because they are all null when the form loads)? At the moment I have only figured out how to do it for the current and next one. In the case where there is a match, I want to clear the values of all the other comboboxes apart from the one in focus i.e. currentDropDown . Code below: Private Sub Form_Load() cboOption2.Enabled = False cboOption3.Enabled = False cboOption4.Enabled =

List Box items not highlighted when clicking on them

和自甴很熟 提交于 2019-12-13 04:47:10
问题 I have a list box in a form. Clicking on it causes the form to jump to another record. It supposed to highlight an item and jump to the correct record. Instead, it highlights, and then instantly clears the selection, although it still jumps to the record. When I use standard record selection buttons, items are correctly highlighted. I read the index of selected item from .ListIndex property because Selected() does not work in a Single Selection mode when I test which item is selected. However

oAuth client in Office VBA what is difficult?

本小妞迷上赌 提交于 2019-12-13 04:45:55
问题 I cannot find any oAuth sample code and saw others were desperately searching for it, what's the difficult part to implement an oAuth client in VBA ? 回答1: or twitter sample http://www.twopblog.com/2010/09/using-excel-as-twitter-client-with.html 回答2: You can download an Excel sample for OAuth from http://www.turingbook.net/home/excelkara-oauthshiyo-u 来源: https://stackoverflow.com/questions/3798702/oauth-client-in-office-vba-what-is-difficult

Access and Word 2010 merging one record depending on subform button clicked

和自甴很熟 提交于 2019-12-13 04:38:22
问题 I'm working on a small program in which one letter in Word needs to be create when one button in a Access subform is clicked. The form represents one client and in the subform there are the list of commands done by this client. Next each command line (containing date and description), there is one button that trigger the maccro and create the letter. Until now, I succeed to create the word letter when one button is clicked but each command in the subform create a page in the word document. Is

Working code to import tab delimited txt file with more than 255 fields into two Access Tables

耗尽温柔 提交于 2019-12-13 04:32:34
问题 This code below will import a tab delimited file with over 255 fields into two tables. Just make sure when you design your two tables all your fields have the correct data types for the fields being imported. I originally created my tables by using Access import text file wizard. Before using the wizard I deleted the fields after 255 to create the first table and then deleted the first 255 to create the second table. Hopes this helps someone and thanks to everyone below who helped me with