Expert help needed for fairly new N00b

Makaveli

Access SMP
Local time
Today, 06:33
Joined
Jul 1, 2008
Messages
17
Im fairly new to this programme, i've asked on various forums/chatrooms and have browsed every form page on here and other forums. I still haven't got an answer. EXPERTS please help :)

I have one form called propertys and another called vendor.
In the form propertys i have a button that opens up the other form called vendor, and like a subform (which i cant use in this case because of the massive amount of data) I have restricted the form vendor to the data being displayed in propertys by using the code at the bottom of this post. (which im no good at)

With this code the vendor form in data entry links the data via the property id field which is a auto/key number to the propertys table.

So when i add new data in the valuation form access relates it back to the property,

however when i have this form in a mode where i can also browse through the data it doesnt just limit it to the property id selected in the property form but it goes through all the data ever entered in the valuation form regardless of propperty id.

Can anyone please help me come up with a soloution where the valuation form is limited via the property selected. Thanks Makaveli


Propertys code:-

Private Sub Vendor_Click()
On Error GoTo Err_Vendor_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "02 Create Vendor"
DoCmd.OpenForm "02 Create Vendor", acNormal, , [Property ID] = " & me.[property id]"
Exit_Vendor_Click:
Exit Sub
Err_Vendor_Click:
MsgBox Err.Description
Resume Exit_Vendor_Click

Vendors code:-
Private Sub Form_beforeUpdate(Cancel As Integer)
Me.[Property ID] = Forms![add-edit-search property]![Property ID]
End Sub
 
The syntax is incorrect, and the spaces are not advised. Try this:

DoCmd.OpenForm "[02 Create Vendor]", acNormal, , "[Property ID] = " & me.[property id]

which assumes [Property ID] is a numeric data type in the table.
 
The syntax is incorrect, and the spaces are not advised. Try this:

DoCmd.OpenForm "[02 Create Vendor]", acNormal, , "[Property ID] = " & me.[property id]

which assumes [Property ID] is a numeric data type in the table.

It is a numeric data type, its an autonumber and unique id in the properties table
I pasted that code over the existing, due to the [] around the part ive highligted i get an error box pop up stating,

(run time error 2102, the form name "[02 Create vendor]" is misspelled or refers to a form that doesn't exist.

same happens if i remove the speech marks and leave the brackets, the code works OK the way it is, the real problem is in my first post
thanks for the reply though :)
 
I never use spaces in field names, so maybe the brackets aren't required around the form name (they are around the field name). Try this:

DoCmd.OpenForm "02 Create Vendor", acNormal, , "[Property ID] = " & me.[property id]
 
I never use spaces in field names, so maybe the brackets aren't required around the form name (they are around the field name). Try this:

DoCmd.OpenForm "02 Create Vendor", acNormal, , "[Property ID] = " & me.[property id]


No way!!!!!!!!
Your a "£$!!%^&££" GENIOUS!!!!!

Thanks for your help, i cant belive it was that simple. :D
 
No problem; I'd like to accept the genius tag, but too many people know better. :p
 

Users who are viewing this thread

Back
Top Bottom