| re: Visible Command Button
"Darren" <Yeo.darren@gmail.com> wrote in message
news:1138856404.218020.306750@g49g2000cwa.googlegr oups.com...[color=blue]
> 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![/color]
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. |