468,301 Members | 1,478 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

VBA Script problem in Access?


Im making a db for my company.. Ive created an orders form that has a subform in it. The Order form (parent(is linked to a Orders Qry)) and the Orders Subform (Child(is linked to Order Details Extended Qry).

This works similar to the Orders form in Northwind, ok ok its pretty much identitcal ;) What happens is i select a client in the main form by selecting the company name and that pulls up their details. In the Subform im supposed to select a product and enter the quantity being ordered. However when i select a 2nd product i get a vba error:

Compile error: Sub or Function not defined..

Heres the code:

Private Sub Form_BeforeUpdate(Cancel As Integer)
' If Orders Subform is opened as a standalone form, display a message
' and undo changes made to the ProductName text box. (The IsLoaded function
' finds a form in the Forms collection when it's opened as a standalone
' form, but not when it's opened as a subform on a main form.)

Dim strMsg As String, strTitle As String
Dim intStyle As Integer

If IsLoaded("Orders Subform") Then
strMsg = "You can't add or edit a record when you open Orders Subform as a standalone form."
intStyle = vbOKOnly
strTitle = "Can't Add or Change Record"
MsgBox strMsg, intStyle, strTitle
End If

End Sub

the IsLoaded part gets highlighted.

Please help!! :> Thanks alot
Nov 15 '06 #1
0 752

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by koolyio | last post: by
2 posts views Thread by Bobby | last post: by
9 posts views Thread by Karl Irvin | last post: by
7 posts views Thread by rein.petersen | last post: by
5 posts views Thread by Moskie | last post: by
10 posts views Thread by Jerim | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.