PDA

View Full Version : Solved: Pop-up box comes up for no reason.



zdunham
09-23-2008, 11:33 AM
Hi, I have a button with this VBA code executed on click:



Private Sub Command4_Click()
Dim inputString As String
inputString = InputBox("Enter System Name: ")
If inputString = "" Then
DoCmd.OpenForm "MainForm", , , , acFormEdit
Else
DoCmd.OpenForm "MainForm", , , "SName = '" & inputString & "'", acFormEdit
End If
End Sub


The button is clicked when the user wants to edit a system rather than
make a new one. The problem here is that a second InputBox pops up
after the first one asking for Model.Brand. Where else could code be
executed that would make that pop up? There is a model table and a
brand table that are both used to generate drop-down lists and the
selection is saved in the system table with referential integrity to
the other tables. Model and Brand tables are not related. Thanks for
any help.

Slyboots
09-23-2008, 11:44 AM
This would happen when a control on MainForm requires this information -- you might have a dropdown box linked to a parameter query on the Model table, for example. Does this help?

S

zdunham
09-23-2008, 11:50 AM
This would happen when a control on MainForm requires this information -- you might have a dropdown box linked to a parameter query on the Model table, for example. Does this help?

S
Thanks for replying.

If I had a parameter query would it be listed under the Queries section on that left side tool bar? If so I have no queries there. I just thought of something else. The Brand table used to be linked to a Brand field that was in the Model table. I took Brand out of the model table and moved it to the main System table and rearranged the relationship. Could that be a reason it asks for Model.Brand if something wasn't deleted correctly? And if so what could I do?

Thanks again.

Slyboots
09-23-2008, 12:14 PM
In the Database window, select the Relationships button on the toolbar, or select Tools, Relationships. Select ALL of the relevant tables. You can then click on any of the relationship lines to remove them.

S

zdunham
09-23-2008, 12:18 PM
In the Database window, select the Relationships button on the toolbar, or select Tools, Relationships. Select ALL of the relevant tables. You can then click on any of the relationship lines to remove them.

S

Thanks again, its still doing it after that, on another forum it was suggested that I had a control source linking to Model.Brand and it couldn't find it so it gave me a pop-up but I couldn't find an object with that control source, is there any search function in access?

zdunham
09-23-2008, 12:28 PM
I just figured it out it was in the MainForm control source, wow, I feel dumb. Thanks for your help a lot.