By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,688 Members | 1,845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,688 IT Pros & Developers. It's quick & easy.

Visible Command Button

P: n/a
Hi,

I have a command button which has a macro running in it.

The macro on the click event, runs to ensure that certain values in a
form are valid, (e.g. the textboxes are not null)

and after the macro runs, an update query would run...

the problem is that how can i ensure that the update query would only
run after the macro find that the fields entered are valid..

i was thinkin i first place a command button to run the query, and
after the query has been run and the fields entered are valid, then
another command button appears to allow user to click to run the query.

i know the command button can be made visible after a certain condition
has been met..but all the conditions are found in a macro..so can i put
in VBA: If macro.NameofMacro = True, then run the query?

Thanks in advance!

Feb 2 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Darren" <Ye********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,

I have a command button which has a macro running in it.

The macro on the click event, runs to ensure that certain values in a
form are valid, (e.g. the textboxes are not null)

and after the macro runs, an update query would run...

the problem is that how can i ensure that the update query would only
run after the macro find that the fields entered are valid..

i was thinkin i first place a command button to run the query, and
after the query has been run and the fields entered are valid, then
another command button appears to allow user to click to run the query.

i know the command button can be made visible after a certain condition
has been met..but all the conditions are found in a macro..so can i put
in VBA: If macro.NameofMacro = True, then run the query?

Thanks in advance!

It looks like you are making things very difficult for yourself. Normally
forms are bound to a datasource and that does all the work for you. You set
the required property of fields to true and then trying to save a record
would result in an error which you could catch and deal with.
Creating an unbound form with a button to add or update records is possible,
but really this is above what macros are good for - you should be writing
proper vba code with error-handling to make sure your code works.
Is there something special about your situation here, perhaps like you want
to do a batch update or something? Perhaps post a quick explanation and
indicate whether you would be OK with vba code as opposed to the pretty
limited Access macros.


Feb 2 '06 #2

P: n/a
i see...coz what i need to do is to update a user password...
therefore, i need to validate whether the user provided the correct
password, and also whether the new and confirmed password matches..
Then can i run the update query to change the password...
but in this case, the query runs irregardless whether the macro does
the validation or not..

And even if the input were valid/ correct, then i would run another
macro to go to the default logon screen..

Do note that it's a custom logon form, not Access level security...i'm
not using it because there's no need for a small company with few
users...

Thanxs! Ya see, i'm very new with access..

Feb 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.