That's not the name of your field, and there are too many single quotes:
DoCmd.OpenForm "Building+Assets", , , "[Building ID] = " & Me.txt_BuildingID
The spaces and symbols in your names are not a good idea.
That's not the name of your field, and there are too many single quotes:
DoCmd.OpenForm "Building+Assets", , , "[Building ID] = " & Me.txt_BuildingID
The spaces and symbols in your names are not a good idea.
Thank you mate,
I think im complete newbie when it comes to VBA, i tried the code, but still pops up with the box asking to enter the value... (( Its so frustrating. Could you please edit the piece of code i have in my latest copy of the db, i you have a spare minute. Would be much appreciated. .. the boss is getting on my nervous with this thing
The file is attached
Many thanks
Pbable I figured it out !!! Oh, god thank for you help. You are my hero ))!!
Could you explain me why for the Second form I had to assigned the Record Source Name in VBA [Building ID], not the field name txtBuildingID.. but for the intial Record i assigned the field name txtBuilding... ?? Thats why i couldnt figured it out for so long, i was keep assigning the wrong name ) lol
The field name (in the table) is [Building ID]. The name of the control (text box) on the form is txt_BuildingID. The wherecondition argument is a SQL "where" clause without the word "where", which would be along the lines of
WHERE FieldName = 123
so the first part needs to be the field in the table, and the second part needs to be the form control where the value 123 can be found.
Great !! you are real lifesaver
Hey mate, just a quick question - what is the function that would refresh the content of the second form before opening? because i have to save the content of the Building Form before i can go ahead and hit "View Asset Register", and see the information.
Not clear on what you mean. The second form would get fresh data when opened. If you mean saving the contents of the first form before opening the second:
DoCmd.RunCommand acCmdSaveRecord
or
If Me.Dirty Then Me.Dirty = False
yeah, that what i meant And i would i apply it to Building Form in onDirty event? Thank you for help
Personally I'd probably have it behind that button, so it saves the record before opening the other form.
Thanks a lot, your help is priceless
haha, sure thing tell him to get a pay rise hehe... Thank you for all your help, making my life easier lol. Really want to learn Access and VBA, but its hard to do it by yourself