2

I took a already set up database from the Office.com templates (File --> New --> Office.com Templates), since this template already gave me 80% of my requirements.

I then changed the last 20% of this template where I came into the following: It seems as this template is a web database. I am not sure about the differences of a web database and a normal database in Access at all but I did find out, they do not allow me to run VBA code. At least not when I am trying to call it by an event.

Is there any way to achieve this anyways? Or are there possibly any other ways, such as converting the web database into a normal one perhaps?

7
  • is there any specific reason you have to use old program language VBA ? Can other alternatives (such as ASP.NET + SQL Server) help ? Commented Jan 14, 2013 at 9:41
  • not especially.. since this is what comes by standard with access, I use VBA. Since I will use the database only locally and having no complex code in it, I guess VBA might be allright. don't you think? Commented Jan 14, 2013 at 10:20
  • @ShivanRaptor VBA continues to be updated and supported. The average Office worker now requires far more from Office products than can be achieved without some coding and VBA works very well for that. In addition, Access 2013 is due out shortly, so Access is alive and well. Commented Jan 14, 2013 at 11:02
  • Romano Machler, there is no conversion from web to "normal" forms, however see Albert Kallal's comments here help social.msdn.microsoft.com/Forums/en-US/accessdev/thread/… Commented Jan 14, 2013 at 11:14
  • thanks @Remou. So i'm guessing there is no way and I need to recreate the whole database from scratch, don't I? Commented Jan 14, 2013 at 11:43

1 Answer 1

3

Actaully, you can call VBA code from the forms event code. However, it requires a bit of a kluge.

However, you don't need to do this in your case.

Do note that you can create client objects and use client VBA code in your web application.

This means you can add/mix VBA forms into that application (these client objects of course cannot run in a web brwoser, but they can be used the client).

Suggestion #1: to hide record navigation buttons.

Open the web form in layout mode. Move a object (dirty the design).

Whack ctrl-g for VBA command prompt. Type in this:

forms(0).NavigationButtons = False

Now, save the form. The record navigation setting will be saved with the form.

Suggestion #2: Open the web form with VBA. Use this code:

DoCmd.OpenForm "AssetsDetails"
Forms("AssetsDetails").NavigationButtons = False

Suggestion #3: Call VBA code from the forms load event. This is a bit of kluge, but does work:

In the forms open event, place this macro code:

OpenForm (frmRunVBA,,,Dialog)

Note that in above WEB MACRO editor the VBA form above called frmRunVBA does NOT appear in the drop down choice list - but you CAN TYPE/force in the name – this is legal.

Now create a VBA form called frmRunVBA). In the forms load event, palce this code:

Private Sub Form_Load()

   Forms("AssetDetails").NavigationButtons = False
   DoCmd.Close acForm, Me.Name

End Sub

So you can call VBA code, but you really don't need to if you use tip#1.

Sign up to request clarification or add additional context in comments.

2 Comments

woow great! will try this out. thank you! oh and btw, do you know how to remove these two elements in my form? goo.gl/o9peL, goo.gl/vMZB9
That UI item is a record selector - same approach as above (all 3 examples), but you can use >>forms(0).RecordSelectors = false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.