UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Error 2491 '...form Isn't Bound...' Loading Forms    
 
   
edaroc
post Mar 9 2010, 04:51 PM
Post#1



Posts: 1,028
Joined: 27-July 04
From: Rochester NY USA


Have a Main Menu form which, at this time, is a placeholder for a main menu. (Each Access mdb file runs a report, or, in this case a database app - some day I'll merge them into the one mdb app).
On the Main Menu's code I put code to open the applicable form(s), this is my first time to open more than 1 form:
1. frmInkRequests - is bound to a table InkRequests, is for editing the records in the table and has buttons for the other two forms.
2. frmInkRequests_List - is a Pick List (list box) so the user can quickly view open Ink Request records, apply filters to view other record sets, and double click on a row in the list box to 'go to' that record on frmInkRequests. It is not bound to anything.
3. frmInkRequests_Rpts - is a menu for generating various reports. It is not bound to anything.
When the app opens I want frmInkRequests to open, then frmInkRequests_List to open and be the active form so the user can select the record to go to on frmInkRequests. I also want to load frmInkRequests and for it to be not Visible (until the user clicks on the [Reports] button on frmInkRequests.
During development I created frmInkRequests, then frmInkRequests_List, added them to the Main Menu and everything worked OK.
I just finished the frmInkRequests_Rpts and added code to the Main Menu to open the form, hide it, and make frmInkRequest_List visible. Error 2491 occurs at the DoCmd.OpenForm ...InkRequests_Rpts...
I don't understand why this is happening since _List is not bound to anything. (I wonder if the error is a 'misnomer' - not exactly what is wrong).
CODE
Private Sub Form_Load()
    
    gstUserID = VBA.Environ("USERNAME")
    Me.txtUserID = gstUserID
    
    'Load associated forms
    DoCmd.OpenForm "frmInkRequests", acNormal, , acFormEdit
    DoCmd.OpenForm "frmInkRequests_List", acNormal, , acFormReadOnly
    DoCmd.OpenForm "frmInkRequests_Rpts", acNormal, , acFormReadOnly
    Forms("frmInkRequests_Rpts").Visible = False
    Forms("frmInkRequests_List").Visible = True
    
    
    'Close the Main Menu until functionality is implemented
    DoCmd.Close acForm, "frmMainMenu"
    
End Sub

The error occurs at statement: DoCmd.OpenForm "frmInkRequests_Rpts", acNormal, , acFormReadOnly
Maybe there's a better way to load the forms and then display the ones I want.
BTW - Is it important to add that in frmInkRequests_List's Form_Deactivate the statement: Me.Visible = False?
Go to the top of the page
 
projecttoday
post Mar 9 2010, 06:45 PM
Post#2


UtterAccess VIP
Posts: 9,017
Joined: 10-February 04
From: South Charleston, WV


What is the message with error 2491? I don't think you need to open all these forms at once. Open the first one and then when the user clicks on that open the second one.
Go to the top of the page
 
LPurvis
post Mar 9 2010, 07:36 PM
Post#3


UtterAccess Editor
Posts: 16,109
Joined: 27-June 06
From: England (North East / South Yorks)


Well not to "big up" my own personal preferences or anything - but chalk up one more win to the "always use named arguments" camp. ohyeah.gif
oCmd.OpenForm "frmInkRequests", acNormal, , acFormEdit
You're passsing the constant acFormEdit in the WhereCondition parameter.
Oimagine you're intending to have
DoCmd.OpenForm "frmInkRequests", acNormal, , , acFormEdit
Subtle difference huh?
DoCmd.OpenForm "frmInkRequests", View:=acNormal, DataMode:=acFormEdit
Doesn't open any ambiguity.
Cheers.
Go to the top of the page
 
LPurvis
post Mar 9 2010, 07:39 PM
Post#4


UtterAccess Editor
Posts: 16,109
Joined: 27-June 06
From: England (North East / South Yorks)


Similarly, rather than opening and then hiding the forms - if you want them hidden, you just just open them as such...
oCmd.OpenForm "frmInkRequests_List", View:=acNormal, DataMode:=acFormReadOnly, WindowMode:=acHidden
Go to the top of the page
 
edaroc
post Mar 10 2010, 07:53 AM
Post#5



Posts: 1,028
Joined: 27-July 04
From: Rochester NY USA


Huh. The Monday evening got the message. Yesterday I still got the message. This morning it opened OK. ?
rojecttoday - Oops. My bad. The complete message is: "The action or method is invalid because the form or report isn't bound to a table or query."
Purvis - I'm going to have fun replying to your suggestion...
Hmm. Typing in all those extra characters or not, Hmm. All those extra characters will also make the file bigger. OMG! Think how much longer it will take to open when I'm working on it!
Can't really say that it's more explicit, we know the constants.
On the other hand, won't lose time with that typo error.
After much deliberation (2 seconds is forever to a CPU) I like your suggestion.
And, the reason I open them all at the same time is in anticipation of a functional main menu - someone correct me if my thinking is wrong:
When the user has similar 'tasks' (i.e. InkRequests is a task and has 3 forms) by opening all the forms upfront then when the others are made visible they will be next to the primary form, not displaced if other tasks had been opened.
Example: Early in the session the user opens InkRequests, which opens the primary and _List, they then open Contacts, which loads the primary and _List forms. Later they are working on InkRequests and decides to run reports which will open the _Rpts form. My thinking is that the _Rpts will open to the far right.
If I load them all up front I'm assuming that when I make it visible it will open next to the primary form and not at the far right.
Thanks.
Go to the top of the page
 
LPurvis
post Mar 10 2010, 09:29 AM
Post#6


UtterAccess Editor
Posts: 16,109
Joined: 27-June 06
From: England (North East / South Yorks)


I think I'm having trouble following what people mean today. :-s
e: Named Parameters - OK (I think). It's a personal thing, but by far my preference. I know the names of the parameters. I use them. No ambiguity.
Re: Forms Opening - I'm not sure what you're imagining. Why would forms open to the right? Are you talking about tabbed windows in Access 2007?
Otherwise the forms will open positioned one over another - unless instructed to do otherwise in your code. (i.e. explicitly positioned).
Go to the top of the page
 
ace
post Mar 10 2010, 10:32 AM
Post#7


UtterAccess VIP
Posts: 5,446
Joined: 26-November 05
From: Upstate NY, USA


My impression (experience) is that unless you explicitly position a form in code or set the auto center property to true
they open where ever they were when last saved in design view.
Go to the top of the page
 
edaroc
post Mar 10 2010, 04:12 PM
Post#8



Posts: 1,028
Joined: 27-July 04
From: Rochester NY USA


It's not you. I should have said that the Access Option is set for Tabbed Documents. You recognized that may be the case - nice job.
Go to the top of the page
 
LPurvis
post Mar 11 2010, 04:30 AM
Post#9


UtterAccess Editor
Posts: 16,109
Joined: 27-June 06
From: England (North East / South Yorks)


Sometimes even a shot in the dark hits the mark. ;-)
Oget lucky once in a blue moon.
(OK, that came out wrong...)
mmm no - not to my knowledge. The form's would re-appear once made visible they would be repositions back to the right hand tabs no?
FWIW I'm not a fan of tabbed forms.
To me, the role of the developer is to take the user on a journey through the application - to where they want but need (and should) be.
Tabs offer this tantilising little "Oh - I'll just pop back to there" option.
And if they're going to be hidden - then, to me, they might as well be restored windows.
Cheers.
Go to the top of the page
 
edaroc
post Mar 11 2010, 08:26 AM
Post#10



Posts: 1,028
Joined: 27-July 04
From: Rochester NY USA


OK, we won't delve on how lucky you are.
et's banter around the interface a bit. I agree the app control's the user's avenues, or, put another way, manages. I like to design to the user's perspective, managing the UI so the user's workflow is efficient and effective.
In the design I'm working on the app, i.e. the 'task', is to manage Ink Requests (IR) - a form given to the ink room to produce color samples. As said in previous message, there are 3 forms for this task - the primary (IR) form, Picklist, and Reports Menu. The frequency of the IR tasks will be: (1) Review or edit an existing IR - hence they will want to go to a specific IR - the Picklist, (2) add a new one, (3) run a report. Hence, putting the Picklist on top at startup. This form also has filters so the user can perform various reviews of IRs in the db. They can get back to the primary form by either (1) picking an IR on the PickList or (2) clicking on the IR's tab. The reason I want to leave the Picklist open is to preserve filtering the user may have performed.
The reason I hide the tabs when they are not in use is for when I merge all the separate Access files into one app with a Main Menu. If all the tabs are left open for all the tasks (i.e. IR is a task) then the tab row will be cluttered, and possibly become so compressed one can't read what each of them are. All this comes from reviewing our situation and processes. It may not be applicable to everyone's situation. Hence, one reason we have our jobs (Programmer/Analysts).
I'd like to hear comments back on my thinking, input, etc. An exchange of ideas can.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th February 2018 - 03:38 AM