Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Forms

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-08-2010, 02:06 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default Form Auto population

i guys,
Im completly new to Access and have been asked to build a database which includes, three main tables customers, buildings and asset register for each building. As you can see from Customer Form, i created a button called Asset Register, which brings up Asset Form based on Macro <OpenForm = Asset, Datasheet, , , , Normal; ApplyFilter = [Asset]![Building ID]=[Forms]![Customer]![Building].[Form]![txt_BuildingID].[Value], >. (Not too sure if its right way, but it works).
The problem is when i open up Asset Register Form - i can input all the information and it will be saved in Asset Register Table, but i have to input Building ID manuly for the same building, and i have about 300 items ;(. How do i automate this proccess, so building ID populates automaitcly for all items when i enter information (and saves it in Asset Register Table)?
Please inform me if i made very stupid mistakes in my database, any critisism will be appreciated, i am trying to learn Access
Attached Files
File Type: zip Copy of Copy of Service Database.zip (155.5 KB, 11 views)
Reply With Quote
  #2  
Old 04-08-2010, 03:11 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,498
pbaldy is on a distinguished road
Default

A more common method of displaying data with a one-to-many relationship would be a form/subform. In your case, the form would be based on the building table, and the subform would be based on the assets table. They would be linked on the building ID, and master/child links would automatically populate the building ID for you when entering assets. If you want to stay with your method, you could make the default value of the textbox refer to the form containing the building ID.

I just noticed you have the customer form set up like I mentioned, so you already know about it. You might consider opening a form set up like that when clicking on your asset register button.

I would avoid spaces and symbols in your object names. In the long run, they aren't worth the trouble. Some use underscores "Asset_location"; though personally I hate them and use capitalization "AssetLocation".
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #3  
Old 04-08-2010, 03:18 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

Thank you for prompt reply. I will give your solution a try. In general, how would you comment on my db structure? am I on the right track? I am self-learner.
Reply With Quote
  #4  
Old 04-08-2010, 03:26 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,498
pbaldy is on a distinguished road
Default

Other than the previous comments, it looks fine. I'd say you're on the right track.

Welcome to the site by the way!
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #5  
Old 04-08-2010, 03:37 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

Thank you pbaldy. I played around with solution you suggested, but it only got my db messier lol. Please suggest if you could provide a quick visual example. Really need to get this done, I has been suffering with it for few days now (.

Appreciate your time
Reply With Quote
  #6  
Old 04-08-2010, 04:27 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

pbably, i figured out what you were trying to tell me!!! The solution was easire than i thought, spent days writing all sort of weird formulas for nothing lol!!

Thank You, your a legend
Reply With Quote
  #7  
Old 04-08-2010, 06:02 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,498
pbaldy is on a distinguished road
Default

Excellent! Glad you got it sorted out.
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #8  
Old 04-08-2010, 06:15 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

As i managed to autopopulate data, i got completly stuck again ((( The code provided above used to work for retrieving particular record based on the filter, however its gone completly mad now (or may be i have ). Please advise on the macro for VIEW ASSET button.


Kind Regards
Reply With Quote
  #9  
Old 04-08-2010, 06:16 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

file attached
Attached Files
File Type: zip Service.zip (117.4 KB, 13 views)
Reply With Quote
  #10  
Old 04-08-2010, 06:17 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,498
pbaldy is on a distinguished road
Default

I often use this technique to restrict records on a form/report being opened:

http://www.baldyweb.com/wherecondition.htm
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #11  
Old 04-08-2010, 06:22 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

hey, thank you. I never used VBA, how do you declare DoCmd.OpenForm ? As i undestand in Private Sub ButtonName_Click()?
Reply With Quote
  #12  
Old 04-08-2010, 07:17 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

Nothing seems to work ((( , Tried applying filters and i tried your VBA functions. Completly stuck now.
Reply With Quote
  #13  
Old 04-08-2010, 10:01 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,498
pbaldy is on a distinguished road
Default

Here's a primer on using VBA:

http://www.baldyweb.com/FirstVBA.htm

My bedtime, so if you're still stuck, post the db so far and I'll take a look in the morning.
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #14  
Old 04-10-2010, 11:32 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

hey, thank you for reply. I am still stuck unfortunately . I attached the db, please suggest if you have time.

Kind Regards,

Evgeny
Attached Files
File Type: zip Database1.zip (74.4 KB, 6 views)
Reply With Quote
  #15  
Old 04-11-2010, 02:59 PM
Evgeny's Avatar
Evgeny Evgeny is offline Windows XP Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Apr 2010
Posts: 85
Evgeny is on a distinguished road
Default

This code returns run - time "3075" error...


Private Sub Command13_Click()
DoCmd.OpenForm "Building+Assets", , , "txt_BuildingID2 = ''" & Me.txt_BuildingID

End Sub
Attached Files
File Type: zip Service1.zip (108.4 KB, 8 views)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Auto population Evgeny Access 3 04-08-2010 03:17 PM
Auto Formatting Text in a Form swicklund Access 0 07-23-2009 11:15 AM
Automatic field check and population danidin Forms 0 01-03-2009 09:45 AM
Auto populate fields on a form ldarley Forms 0 08-14-2008 07:39 AM
Auto Scroll in a Form delliott777 Forms 0 05-31-2008 05:02 AM


All times are GMT -8. The time now is 10:07 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.