Surely i dont have to ...

bobby

Registered User.
Local time
Today, 23:21
Joined
Apr 29, 2004
Messages
28
Hello, im doing a university assignment and i was told off for using vba code, this was preety fair thoguh because i coded my whole access database in vba, so that was ok.

But im wondering how to do this. I have a main menu, with three buttons on it, when there clicked they open up the relevant forms. How can i do this, i believe i only have two choices:

1. Use three macros, all using an open form command
2. Use vba to create event procedures.

So does that mean ill end up with about 20 macros, all opening and closing forms?

This may be a stupid question but i am inexperienced with access.
 
How's that assignment coming along?

I am still at a loss as to why your "educator" has an aversion to VBA.

Coding behind the buttons is the correct way.

Macros do not allow for any error handling.

As discussed in previous posts, I would seriously question the VBA ban.

I know of a few forum regulars that would be happy to stand up and fight the authorities with you ;)

Brad.
 
Grrrrr! :mad:

VBA is just a part of Access as a form or a macro. I'll bet your lecturer doesn't know VBA and would not know how to mark it and that would explain the aversion.

One macro (an autoexec, if necessary) is all that should be needed for a database. Macros are lazy, messy, and crap.
 
Well there wasnt exactly a ban on it. What happend is we have to design a database system using MS Access.

I basically designed the forms, but done all queries in the vba code, instead of using access's query module thingies.

So thats why i was told off.

From your reactions, i'm sure that it'll be fine to use vba to open a couple of forms.

Thanks, it was a big help.

Bradcccs : its going well. I finished most of it actually. I done really well, spent 12 hours doing it yesterday, i was up until 4am this morning !

Well im hoping to get it basically finished today, then all i have to do is the testing and a little write up.
 
bobby said:
I basically designed the forms, but done all queries in the vba code, instead of using access's query module thingies.

The only reasonable time to do this is when creating a new QueryDef. If your SQL is never dynamic ( that is the whole structure of the SQL changes and not just criteria) then you should always save a stored query. The don't reuse space and are faster than SQL coded in VBA.
 
How would you recommend getting the recordsource for a form that can be opened in a variety of ways - all the data comes from one table -(the fields are always the same) but sometimes I just want records based on companyID, othertimes ContactID or UserID etc etc or combinations of the above - what is the best way to do this??

I can't work out efficient ways of passing the parameters or not (depending on the criteria I want) and end up writing my criteria as SQL in vba

Paul
 
Will this not slow me down by bringing in all records - then filtering - when all I want is specific records?
 
Code:
DoCmd.OpenForm "frmExample", , , "FieldID = " & someValue
 
This opens the form filtered (i can remove the filter and get all records)- would it not be quicker to open with just the records that you want? Or am i miss understanding what access is doing?
 
Then use a Parameter Query, depends on how many records your dealing with as to which is quicker
 

Users who are viewing this thread

Back
Top Bottom