Link to home
Start Free TrialLog in
Avatar of Travwoody
Travwoody

asked on

Code not working for Access 2007 Open Form Wizard

Good evening!

Though the code is probably very close, I was not able to get this working in an application I am building using two unbound forms.  When I click the button now nothing happens.  I have one form (frmSurveyResults) that will open to another (frmSurveyResultsPg2) to complete a record in a table.  Initially I need this to open to a new form.  However, in this case I need the form to open to an existing table field called "SurveyID".  The following is what I have from your example:
Private Sub Command402_Click()
DoCmd.OpenForm "frmSurveyResultsPg2", , , "SurveyID=" & Me.SurveyID
End Sub[
Your help is greatly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
also, your Database must be in a Trusted Location to enable the Codes to work
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Travwoody
Travwoody

ASKER

I was able to go around the restrictions that I was facing by using the tabbed form in Access 2007.  This gave me more room to list out form fields so that I did not have to use a second form.  However I also could not get the list to populate even when using a bound form and then going through the wizard.  Though the forms had related fields from the same table, the fields never showed up in using the wizard.
This question is answered and seems to be a limitation or program issue.
How has the question been answered? Please advise as two similar answers given with a similar time.

Did you try argument passing? from what I gather you do not have seem to have bothered to try it. If you are using two unbounded forms as you clearly said, you can pass the survery id in using argument passing. Obviously since you have unbounded forms you have code already that reads the table and populates your form.

Going by the rules of a previous post I was dealing with you have to post your own solution or if nothing worked then request a delete with refund or accept your own comments.
Let me know if you tried argument passing
i.e. what I mentioned in my first post


Otherwise last argument is argument passing between forms
eg
DoCmd.OpenForm "frmSurveyResultsPg2", , , , , , Me.SurveyID

then in form_open or form_load of frmSurveryResultsPg2 you can get the survey id by referencing prefefined variable OpenArgs


If you need more information then ask
I guess that the question itself was only patially answered.  I did use the VBA code and it partially worked.  However I could never get the two forms to cooperate very well on one table so I actuallu redesigned this so that I used a tabbed form, thus elliminating the need for two separate forms to feed into one table.  This was a much easier solution for me and for those that will be entering data later.  I got this solution by further researching forms on a spearate site.
This is only a partial solution.  The form length was my problem as I had a lot of fields in the form  and therefore had to break it into two separate forms.  Tabbed view took care of this.
to use two forms based one table is possible considering you are using unbounded forms as there is no locking problems unless lock introduced in one form and a update in the other. Like I said before using OpenArgs will allow you to pass the survery id between two forms without problems.