PDA

View Full Version : Form opened in 2000 but will not in 2007



daniels012
12-22-2008, 06:39 AM
Is there anything code or VBA that would prevent a form from opening since we switched from office 2000 to 2007?

Michael

CreganTur
12-22-2008, 07:33 AM
Do you have code as a prt of your form's OnLoad event? If your .accdb in a safe folder so that the code is setup to run?

daniels012
12-22-2008, 07:47 AM
This is what I have in OnLoad:
Private Sub Form_Load()
Dim strID As String
If IsNull(Me.OpenArgs) Then Exit Sub
strID = Me.OpenArgs
BillToID.Value = strID
DoCmd.Close acForm, "frmSearch"

End Sub

I am noit sure about your 2nd question. But other forms in this same database open fine, if this answers your question.
Michael

daniels012
12-22-2008, 07:54 AM
I took out my macro for OnOpen:
It has a Macro:
GoToRecord
Form
RequestForWO
New
GoToControl
BillToID

As soon as I removed this is worked? Ideas why?
It would be nice to have the form open on a new blank record.

Michael

CreganTur
12-22-2008, 08:10 AM
Nope... no idea why removing the macro would fix your issue. I never use macros (VBA is vastly superior). It could be some glitch specific to 2007.


It would be nice to have the form open on a new blank record.
This is easy to do- you just have to decide something. Is this form going to be a data entry form- where the user is only going to enter new data, or are they allowed to review existing records? I ask because there is a Data Entry property under the Data tab. Setting it to true make the form always open on the new record- but the form is for data entry only, not for searching or working with existing records.

The other option is to use VBA. As a part of your form OnOpen event you could use:
DoCmd.GoToRecord , , acNext

daniels012
12-22-2008, 08:18 AM
Tried that, It did not work, it still opens on the 1st record???
Any other idea? Do I need the code for form load that I have listed above?
Michael