Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 21st, 2004, 03:46 PM
gfulton gfulton is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Atlanta, GA
Posts: 42 gfulton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 53 sec
Reputation Power: 5
Auto Populate question

I am considering using Access for an upcoming Inventory project. I have the database all nicely made and organized, now what I am wondering is when the database is opened, can I have a form that asks "What Room Are You Working In" ... the user enters the room name and then it auto populates a field on a form. (I have that part) BUT...can it be made that when the person tabs to the next record (new record) the Room field is still populated with their choice?

Thanks for any input.

Gale Fulton

Reply With Quote
  #2  
Old December 21st, 2004, 04:43 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Gale,

Not exactly sure this is what you are needing, but if you wanted a particular field to autopopulate with a field from the last record, you can use something like this in the On Current event of your form

Dim intNewRecord As Integer
intNewRecord = Me.NewRecord

If intNewRecord = True Then
Room.DefaultValue = DLast("[Room]", "tblName")
End If

See if this is something close to what you were looking for.
lwells

Reply With Quote
  #3  
Old December 23rd, 2004, 07:46 AM
gfulton gfulton is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Atlanta, GA
Posts: 42 gfulton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 53 sec
Reputation Power: 5
That worked nice! But now when the form opens, there is an error because the first record has that field blank. How do I make the form that pops up and asks "What Room" populate the field the first time?

Happy Holidays

Reply With Quote
  #4  
Old December 23rd, 2004, 05:03 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Gale,

I would trap the error which is error number 94 (Invalid Use Of Null) and use that error number to open your form with:

On Error GoTo Err_Handler

'Original code goes here

Exit_Handler:
Exit Sub

Err_Handler:
If Err.Number = 94 Then
DoCmd.OpenForm "What Room Form"
Else
Msgbox Err.Description & " " & Err.Number
Resume Exit_Handler

This would open your "What Room" form if it is the first record.

lwells

Reply With Quote
  #5  
Old December 28th, 2004, 02:30 PM
MrBullwinkle MrBullwinkle is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Wild and Wonderful, West Virginia
Posts: 27 MrBullwinkle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to MrBullwinkle Send a message via AIM to MrBullwinkle Send a message via MSN to MrBullwinkle Send a message via Yahoo to MrBullwinkle
You could create a form asking, then set that form as the opening form. "An interrogative splash." <-- Made that up

A simple Input box would prolly be cleaner, so you could open with a macro.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Auto Populate question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT