Append query problem

David_Skov

Active Member
Joined
Jun 29, 2004
Messages
267
I have an append query that adds a set of numbers to a table depending on a choice given by the user. The choice is a simple number i.e. 200409 (september 2004). I have several append queries and because of that (and my lack of VB skills) I created an access macro that handles all the append queries and finally returns the result in a report. But if the user type in wrong data it gives an error which for 'normal' users look weird.

Is there a way to make sure that the user either:

1. can't move further if the data isn't valid?

or

2. The program just exits?

I'm afraid I have to use VB which I can't :oops: but perhaps you can help?

I have the following queries activated in the same order:

delete query 1
append query 1
Delete query 2
Append query 2
Append query 3
Append query 4
Append query 5
Append query 6
Append query 7
Append query 8
Append query 9
Append query 10
Append query 11
Append query 12
Append query 13

Finally I opens the report

Plz don't ask why I have that many append queries :LOL:

In advance tx (y)
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi David,

there was a similar question about terminating a macro that I answered here that you might want to have a look at. My answer in that thread has a link to MS technet which helps with using a condition in a macro (which is what I think you want to do). That is one way of doing it - i.e. stop the macro if the user enters the wrong date.

BUT, before you do anything, there is an alternative :

A better way may be to have the user pick a date from a drop-down box so that they can't enter the wrong date. If you had a query behind the date field on the dialogue box that asked the user to pick a period from the list e.g.

200410
200409
200408
200407
etc etc

then they can't enter the wrong date. That might be the safer way to go.

HTH, Andrew. :)
 
Upvote 0
That last suggestion sounds good, but how to make a drop down list from a query?

In the meantime I will look at the other part :)
 
Upvote 0
Hi David

If you create a drop down box using the toolbox in the form design, a wizard should start up asking you where you want to get the information from for the combo box.

This page or this page might help with setting up a combo box.

HTH, Andrew. :)
 
Upvote 0

Forum statistics

Threads
1,221,828
Messages
6,162,215
Members
451,752
Latest member
freddocp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top