how to click "Yes" in a macro.....

I have a number of queries set up in a macro, however some ask for approval before finishing, i.e. append xx records. How can i have that automatically approve and continue to the next query?

Many thanks!

Post your answer or comment

comments powered by Disqus
I'm guessing this is really simple. I want to display "Yes" in a report if a checkbox is checked, rather than showing a check. Suggestions please???

I can't figure out how to access data in a field in a table. To access data in a control on a form I would just use:
variable = Forms![formName]![controlName].Text

But when I try to use that syntax on data in a table, I get an "Object required" error.

Any suggestions would be greatly appreciated.

OK guys - This is a tough one.

I forgot how to insert code in a Thread

I remember that there is are special codes that start the code and finish the code entries.




How to open form in a window, not maximized...?

Hello all,

I have created a button called 'Notify person' on an Access form. The purpose of this button is to notify a member of staff when an entry into a table has been made against his / her name.

I have attempted to do this as follows.

In the properties tab of my button, on the event tab, at the On click option
I have created a Macro.

I have selected the SendObject command.

I wish to send the email to the address of the person input into
a field on my table, entitled 'email'. As such in the
'to' column of the action arguments (in the macro) I have entered [email]

This however, does not work and I receive the message (unknown message
recipient, the message was not sent).

I guess I'm just not specifying the field properly, but essentially I want
to send the email to whatever address is specified in the 'email' field.

Many thanks in advance.


Hello, I have set up a Macro that automates the file import process for my users. As part of this Macro, it deletes the old file and replaces it with the new imported file. I would like to set something up that warns them before proceeding, such as "Clicking 'Yes' will delete the existing file." I have been able to set up this warning but am unable to figure out how to prompt the user to select 'Yes' or 'No'. Is there a way to do this in a Macro?

Thanks in advance for your help.

Hello all,
I'm a very new Access user, and this is my first database project. It's supposedly a simple database designed to track the checking in and out of Aircards (cellular cards for laptops). I'm not very good at explaining what I want to do, and I've searched for this solution, but I haven't come up with anything that clicks in my brain - but here goes. =)

1. On my main form (Add Aircard Form) and table (aircard_master) there is a value for Current Assigned User (aircard_master.userid)
2. On the main form, there is also a subform that shows actions associated with the currently selected aircard on the main form. (actions such as when it was issued, returned, activated, assigned a phone number, etc) and each action is required to have a date assigned to it. These actions are stored in the table (aircard_actions)

My proposed problem is that I want the Current assigned user to be auto-populated with the last user (aircard_actions.user) when data is entered into the subform (aircard_actions). All this can be seen/done on the main form. At this point, I'm unsure whether it needs to be done in a query, as code when a new action is recorded in that table, or what. But, the data needs to update the original table (aircard_master.userid) automatically based on the latest DATED entry for that associated card (aircard_master.inventory_number), from a non-null entry in the (aircard_actions.user) field.

This was confusing to me even as I wrote it, I know the people here are a lot smarter than I am on these matters, so maybe in makes sense to you. I'm going to try to find a way to link an attachment of the database with test data in it if anyone wants to take a look. It's 2.5MB so I can't attatch it here...
Oops, just figured out how to share it online. Here's the download link for it:

Thanks in advance if anyone has any ideas!

I want to use a form to get user input for the number of times (x) that I need to repeat an action. Then I want to do a "For 1 to X" loop in a macro. I need help on the command to use in the macro. Thanks.

How would you write in a query this calculation.
sum of (requested)-(services)-(cost)
I know how to produce this formula in excel but not in an access query.

I have a table to store our student sick leave records, we would like to print its on a timeline report. I have already sort the db by student name but I don't know how to print it in a single timeline.

Student Record:

StudentA 1/10/2005
StudentA 5/10/2005
StudentB 20/10/2005

Required Timeline Report:
2 3
Date 1 2 3 4 5 .................... 0...........1
Student A X X
Student B X

Seems perfectly fine to run it in a Module, but when I tried to use it in a Macro the drop-down showing all the Saved Imports and Exports did not show all Saved Imports and Exports, only some appeared.

Hi there.

I need some wise words regarding how to "attack/solve" this task.

- I got a acounting system, based on Access -97.
- I got a logistick company which is taking care of sending out our books.
- I got every day an amount of packinglists from the acounting system, which I'm sending to the logistick company, so they can send out my books. I'm using a fax at the moment.

I want to change this rutine, so instead of using the fax I want to send a DB to the logistick company, containing a report for the packinglists and the data for that day.

This takes I find out how to copy the records from the acounting system to the little DB I want to send.
Not a big problem technically but how to do it - IN A USERFRIENDLY WAY ??????????????????????????

Shall / can I use a form to select the records?
Shall / can I use VBA to do it?
How can I automize the exportfunction?

Pleeeaaaasee - clear my mind, I got ton of ideas but I don't know how to get started.....

Best regards
Don Herman

Hi everyone!
I've got a function which I've found on the web wich does exactly what I need it to do.
When I run it manually from the Visual Basic Editor (Alt+F11) in MS Access it works perfectly. However I need to include this function in a macro I'm creating.
I've connected a Macro to a button on a form. I am doing serveral things in this macro like importing a spreadsheet, appending a few table's and so on.
In the middle of all this a want my function to be executed but I cannot seem to get it executed.
It seems I might not be able to call a function from a macro but even when I go into the VB code of the button and try to execute it there is doesn't work.

My function looks like this and it's actually two functions or one is connected to the other or how I should put it.

	Option Compare Database
Function changefieldnames(oldname As String, newname As String)
'----- oldname and newname are passed to this function from
'----- wherever you are in your process. I would do it via a
'----- form, but if the field names you change are the same every
'----- time the process is run, why not store them in a table. The
'----- code you will need to pass the field names to be corrected
'----- from the table is given in Sub readinfieldnames() below.
Dim db As Database
Dim tdf As TableDef
Dim n As Object
Set db = CurrentDb
Set tdf = db.TableDefs("trans1_SMT")
For Each n In tdf.Fields
    If n.Name = oldname Then n.Name = newname
Next n
Set tdf = Nothing
Set db = Nothing
End Function
Sub readinfieldnames()
Dim rst_data As Recordset
'------ Assumes you have a table with 2 columns. Column 1 contains
'------- downloaded field names, column 2 has the names you want
Dim oldfieldname As String, newfieldname As String
Set rst_data = CurrentDb.OpenRecordset("conv_FieldNames")
With rst_data
    Do Until .EOF
        oldfieldname = .Fields(0).Value
        newfieldname = .Fields(1).Value
        changefieldnames oldfieldname, newfieldname
 End With
 Set rst_data = Nothing
End Sub

Any Idea's on what I should write to execute this? I've done a little trial and error but cant seem to run it unless I'm actually in Alt+F11 and doing it manually (and it works just as intended when executing it manually).

First off, Im using Access 2000, and created a new module.

Ok, Here is the info:

-A table called Indexing contains a field Index9
-Index9 needs to be updated to the current date, in a particular format.
-the format is as follows: YYYY-MM-DD

I would Like to create a module to do this, but im not sure how i would make this run or work, meaning do i make a function? how do i get it to run? using a macro? etc etc...

But first off, how do i update Index9 with the date in the particular format?

Here is the code i could come up with:

Sub Format()

Dim strSQL As String

Dim currentdate As Date
Date = Now 'Format(Now, "yyyy-mm-dd") how do i format this?

strSQL = "UPDATE Indexing, SET [Index9] = Date, WHERE [Index9] Is Null;"

DoCmd.RunSQL strSQL

End Sub

-Your Time and efforts are much appreciated

Hello everyone,

I am a student intern and a bit of a novice to Microsoft Access. I have been asked to fix a database that originally had worked fine, however after my workplace switched to Microsoft XP, they changed the security settings so that certain Macro's in that database do not work anymore.

I decided to try to convert the macros into modules via Microsoft Access' automatic converter. However, on the forms of the database, I do not know how to call these functions.

So when I go to the properties of the form, lets say that theres a button which used to be assigned to a macro, I want to now assign it to the converted macro->module. Is that even possible, and if so, how do I go about calling it?

I appreciate any help

Dear access programmers

I've come to an end of my project!
There is only 1 thing to solve..

I NEED to run a macro ( i know it sux, please don't try to make an other solution for this)
I made an public module, now i need the macro to run the module.
How do i do this ?

When i select runcode it see's the function, it sees module but i cannot say open this one.

Do i need to make the code in the module a function to be opend in a macro ? or can i make something that the macro opens the module i want?

thanks in advance ,
i hope you guys can help , since i want this project to end

Nevermind got it to work!
Put the module code in a function +_+

I would like to open a form, only if another form is opened. Can I do this in a macro?

Is there like a condition to that?

Thanks in advance,



I need you help...I am doing my Final Year Project now...
My database has a table call "Data", inside the table there are 2 fields-"Supplier" and "Product". The string value in product column is comma separated (Shown Below).
The rows of this column is unlimited and product is updating. I need to get all the products (values) in the column and filter duplicated values (like 2 and 5) and skip blank row (like 3)...But the question is inside a row, there may be more than one product separated by comma. Can help me how the get the comma separated value and list down in a table (Query?Module?Macro?)?
Expected result:
after that, the values should be added to a combo box allow user to choose.
And I think there should be a loop function to scan the whole column so to get the products...

Will be appreciate for your reply....

I created a program, in accessXP and I would like to hide the "How to Hide the Ask a Question Box" but I need to code this in my code, therefore I don't have to manually remove it from everyone PC, since it is a multi-user database.

Those anyone know how to do this with coding.

These are the steps to do it manually by Microsoft

How to Hide the Ask a Question Box
To hide the Ask a Question box, follow these steps:
In the Office program that you are using, click Customize on the Tools menu.
Right-click the Ask a Question box. Click to clear the Show Ask a Question Box check box.
In the Customize dialog box, click Close.

I think it's something likw this

Application.SetOption "ShowAskAQuestionBox", False


I have a query where I need to hide all duplicates for just one field. There are a few duplicates in this field, but the duplicate records contain different data in the other fields in the query, so the setting the "Unique Values" property to "Yes" doesn't work.

Is there some SQL code or some other way to hide these duplicate records based on just one field column of the query? I would be fine with Access hiding whichever duplicate field's record it found second.

All I can find online is how to hide true duplicate records (all data across all fields is the same) or how to create duplicate finder queries to remove records. Neither options work in my case.


I've an employee information table and its form. Every record contains different images.

I've found that people are suggesting to store images on hard drive, not on the database directly. They suggest to store the image link in a text field. I'm agree with them.

But what I didn't find is how end user will upload a new image? Or, remove an existing one?
I want 2 command buttons right below those images that will enable end user to add/remove an image from form of that employee/new employee. When someone will click on the add image, a browser window will appear and he'she will be able to select the image. Access will save it's link itself. While deleting, access will delete its link too and display no photo image.

I've programming experience in C++(but not in VB).
How can I do that?


I would like to run 10 reports in a macro. The reports are saved as PDF files. However, even when I use SetWarnings to NO, I am still prompted to click OK on the "Save PDF File As" screen. I would like this macro to produce the 10 reports, unattended. I do not want to click OK as each report is processed. Any help would be appreciated.



Hello all

I have several text boxes in a report that should be hidden if their value is 0. Is it possible to do it? How???

I would appreciate very much any help.

Best regards

Hello all,
So I am trying to automate an automatic update of a report to PDF. I am attempting to do it in a Macro since i will be vacating this position in a month and the person who is replacing me has no knowledge of VBA. Hence, I am not familiar with using Macros, I prefer using VBA.

Anyway, what I have done so far is create a query that shows any changes and what facility that change was made to.

My goal with using the Macro function is to esentially write an IF statment:
If AND me.facility=(insert fac ID) THEN
docmd.runmacro "Facility"

I have established macros that generate that report depending on what faciiity has been choosen.

So does anybody have any idea how I could go about creating this in a MACRO?
I've tried the following:

1st Row: Action: OpenQuery "Query Name"
2nd Row: Action: SearchForRecord ARGUMENTS: WHERE date=Date() AND Facility=(insert ID)
3rd Row: CONDITION: True ACTION:RunMacro ARGUMENTS: FacilityName Macro
4th Row: CONDITION: False ACTION: CancelEvent
5th Row: ACTION: Close ARGUMENTS: "Query Name"

Anyway, when I run that Macro, the 3rd row always occurs whether or not that specific facility is in the query or not.

How can I change this Macro to make it so that if the specific facility is not in the query, the 3rd row is skipped and goes to the 4th row?

Any help would be great!

Not finding an answer? Try a Google search.