access-vba

Is it possible to create a check constraint in access and/or DAO?

Hello I am trying to create a check constraint on an access (jet?) table. So, I open the .mdb file with access, go into queries->create query in design view, type esc, then menu->view->query and finally type create table X ( a number, check (a > 20) ) but access thinks that I have a "syntax error in field definition". However, I ...

Execute .NET 3.0 code from Office 2003

I've created a DLL in C# using the .NET 3.0 framework. Below is the code of my DLL namespace CompanyName.Net { [Guid("F7075E8D-A6BD-4590-A3B5-7728C94E372F")] [ClassInterface(ClassInterfaceType.AutoDual)] [ProgId("CompanyName.Net.Webrequest")] public class WebRequest { public string Result { get; private set;...

Output Access Table to XML with node

I'm trying to output data from an Access table as XML. The output looks like example A, what is required looks like example B. My current code to do this is shown below at example C If anyone could help it would be greatly appreciated. Example A: <inlineData inlineDataId="1"> <date>24 AUG, 2009</date> <regis>123456</regis> ...

MS Access: list macro from VBA

I have to deal with a few macros (not VBA) in an inherited Access application. In order to document them, I would like to print or list the actions in those macros, but I am very dissatisfied by the way Access does it. Therefore I want to make my little piece of code to list the macros, their instructions list and parameters to the de...

error code 3021 either bof or eof is true or the current record has been deleted

Hi, I have an Access 2003 database with some visual basic code using ADO calls in it. When I do a strsql0 = "SELECT lnk_stockitm.C_C FROM lnk_stockitm WHERE (((lnk_stockitm.C_C) Like 'T*'));" newRS.Open strsql0, cn1, adOpenKeyset, adLockReadOnly newRS.movelast I get a '3021 either bof or eof is true or the current record has been ...

Changing field in a table from form in Access

Sorry if this is a newbie question, I'm a bit rusty in Access and even more rusty in Visual Basic! I'm trying to find a way of changing a field in a table when a field in another (unrelated) form is changed. More specifically, I'm after a way of reducing the number in the table by whatever the value is in the form field (in a stock cont...

Hiding columns in a Microsoft Access 2007 datasheet with VBA

I am trying to hide specific columns in an Access 2007 split form through code. I need the form to check certain conditions to see whether it needs to display a column or not. I have code in the form's 'Activate' event to hide the column like this: txtControl.ColumnHidden = True This code works in the "Open" event, but if I hide the c...

How to get file path of the file with the running-vba code.

I want to get the folder path from the file who is running the vba-code. For example: the vba-code is in the file C:\myfolded\file.accdb and I want the vba-code to return C:\myfolded\ Is that possible? ...

Copy data from lookup column with multiple values to new record Access 2007

I am copying a record from one table to another in Access 2007. I iterate through each field in the current record and copy that value to the new table. It works fine until I get to my lookup column field that allows multiple values. The name of the lookup column is "Favorite Sports" and the user can select multiple values from a dropdow...

How to save VBA variable in database?

I have a form in Access 2007. In the form is a browse-file button. From the file-picker dialog the files name is saved in a VBA variable. And now to the question, how do I save the file name stored in the VBA-variable in the database? The database has only one table. Hope you can solve this, if not all information you need is provided,...

Calling web service from c++ v6

Hi i have been deploy webservice in vb.net . is there will be any problem if i will cal the webservice from c++ (version 6) or Microsoft Access VBA? Thanks ...

Access: Runtime error '2105' "You can't go to the specified record"

Hello I have a button on a form whose purpose is to add a new record to the underlying table. The OnClick Event code for the button looks like me.dirty = false if me.NewRecord then msgBox("new record") else msgBox("not new record") end if doCmd.goToRecord record := acNewRecord The message box is needed to make...

Microsoft Access 2003 Shared DBF, file is already in use

Friend I am using MS Access 2003 I want to share MDB file on the network for this I put it in the shared folders with options shared database, and define user rights read only. because i just want to give them view only. What I did I made another file & through link the tables from the shared database lying on the network. Problem: If ...

Import file name into list box without path access 2007 vba-

Hi, I am creating a database where users can click a command button, they will be taken to a folder that is stored in a trusted location and they can choose a word document from there and all the names of chosen files will show in a list box on a form. We have the code to double click the file name to open the document. What we are looki...

SendObject in MSAccess giving errors

I am getting the following error while sending mail using a button in MS access form I am using sendObject to send mail using vba code. The host 'smtp' could not be found. Please verify that you have entered the server name correctly. Account: 'pop3', Server: 'smtp', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error: 11001, Erro...

How do I determine if a variant is a whole number in VBA?

Hellow I am looking for an elegant solution to determine if a variant is a whole number in VBA. Unfortunately, if the variant was created from a string, I am stuck. Here's a little test script: dim v as variant v = "42" if v <> round(v) then msgBox("<>") end if Here, the msgBox pops up, probably because the variant was created fro...

Programmatically check for Access database corruption?

Is there a way to programmatically check for database object corruption in Access 2003? My development project has gotten complex enough that it's hard to manually check all the objects after a day of programming to see if some small control, form, report, query, or code object has been corrupted somehow. I already have the data split o...

Dynamic Access Form

I am creating a dynamic form in Access 2003. Each time the form is opened combo boxes are created based on table of "keywords." My code is having trouble deleting old boxes (or their labels, I'm not sure) and every opening after the first gets hung up on duplicate names (Run-time error '2450'). Secondly, junction table holding the "che...

VBA Code Stops Working

The following code is called everytime the form is opened. It works great until the 5th opening and then misses deleting one of the controls. Anyone know why this is? For Each cb In Forms(frmName).Controls If cb.ControlType = acCheckBox Then If Left(cb.Name, 3) = "clr" Then DeleteControl frmName, cb.Name ...

Drilldown using unbound comboboxes with Access "Continuous Form"

There has got to be a simple(r) way to do this. I have a situation where I am listing parts using continuous forms. The parts listing has things like the part type, manufacturer, part number and the quantity. The list is of the part instances & quantity. I can look the other things up from the instance of the part, so displaying exist...