473,569 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to auto-populate fields in an MS Access Form with VB?

4 New Member
I am running Windows XP, Access 2002.
I want to know the VB code for the following:
I want to type in the ID # (it's the primary key and is auto-numbering) and then have the access form autopopulate three fields for that ID # record. (The three fields are called pu, am, and qu). Pu should populate with a vaule of 1. Am should populate with a value of 38. Qu should populate with a value of 1.
Can you please send me the code?
Thank you!
Mar 14 '07 #1
8 2546
willakawill
1,646 Top Contributor
Moved your thread to the Access forum
Mar 14 '07 #2
zeilak
4 New Member
I know how to open VB within Access. What I don't know is how to write code! Can you please help me?
Mar 16 '07 #3
willakawill
1,646 Top Contributor
I know how to open VB within Access. What I don't know is how to write code! Can you please help me?
In Access the language is VBA which is different from vb so this is the correct forum for your question
Mar 16 '07 #4
Denburt
1,356 Recognized Expert Top Contributor
Sounds like you are just looking to set the default property. Right click on the control and go to properties then look for the default value.

If you wanted these values to change for whatever reason you could use the "On Current" event and insert the code for it in there.

Let me know if you need more specifics.
Mar 16 '07 #5
zeilak
4 New Member
I can't just set a default code because it won't be for every record. Just after a certain point in time, I want to type a record ID number and then have it auto populate for that one record only. Can anyone help me write the code for that?
Mar 28 '07 #6
Denburt
1,356 Recognized Expert Top Contributor
I want to type in the ID # (it's the primary key and is auto-numbering)
You can not enter anything into a autonumber field since it generates the numbers for you.

[quote]I can't just set a default code because it won't be for every record. Just after a certain point in time, I want to type a record ID number and then have it auto populate for that one record only. Can anyone help me write the code for that?[/QUOTE}

You really need to be a bit more specific I don't understand what you are saying. It would help if we knew how those figures might change and for what reason.
Mar 29 '07 #7
zeilak
4 New Member
I am NOT trying to change the field that autonumbers.
After I type in the ID # (which is the autonumber) there are several fields for that record. I want then to autopopulate three fields for that ID # record.
(The three fields are called pu, am, and qu).
Pu should populate with a value of 1 (true).
Am should populate with a value of 38
Qu should populate with a value of 1

I will need to change it at times so that:
Am will populate with a value of 60
and Qu will populate with a value of 2

These fields do not have any default vaule, and they are not autonumbered.
Mar 30 '07 #8
Denburt
1,356 Recognized Expert Top Contributor
Well you could store your values in a table a set up a form so you can change these values anytime you want. Then have the default values of these controls reference that table.... I still may not fully understand, but this is one approach.
Mar 31 '07 #9

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

Similar topics

2
2593
by: Manlio Perillo | last post by:
Hi. This post follows "does python have useless destructors". I'm not an expert, so I hope what I will write is meaningfull and clear. Actually in Python there is no possibility to write code that follows C++ RAII pattern. Of course Python objects are not statics like in C++, but in C++ the auto_ptr class is used for enforcing this...
1
13950
by: Glabbeek | last post by:
I'm changing the layout of my site. Instead of using tables, I will use DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not the correct width. Mozilla and Opera are showing the page the way I want. Does anybody know a solution for this? First of all, the code I am using: CSS ------- body {
5
6088
by: Robert Downes | last post by:
I'm using the following in a page that I'm testing in Mozilla: p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto} But the dashed border is extending to the right-edge of the screen. I want it to only extend as far as it needs to to nicely contain the content within (a couple of links). Is width: auto the wrong...
20
2838
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
5
5035
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the CurrentUICulture to what's specified in the querystring. Since I want to allow UICulture auto detecting, I add UICulture = "auto" to page directive on...
5
3253
by: maya | last post by:
at work they decided to center divs thus: body {text-align:center} #content {width: 612px; text-align:left; margin: 0 auto 0 auto; } this works fine in IE & FF, EXCEPT in FF it doesn't work if I change 'auto' to 0 for left and right margin values; I have to leave those at 'auto'.. so I would like to know what exactly means 'auto' -- what...
22
3043
by: nospam_news | last post by:
I currently get asked about my usage of "auto". What is it for? The keyword is clearly superflous here. In contrast to the huge majority of C/C++ developers I write definitions very explicitly like that: int main(char argc, char *argv, char *env) { try { auto Exception mainException(1); mainException.setErrNo(42);
2
3060
by: Piotr K | last post by:
Hi, I've encountered a strange problem with Firefox which I don't have any idea how to resolve. To the point: I've <divelement with a style "height: auto" and I want to retrieve this value ("auto") in JavaScript - however instead of getting "auto" value, I get calculated height. In IE and Opera it simply returns "auto". Any ideas how to...
1
2966
by: neridaj | last post by:
Hello, I've found a few postings of this problem but none of the answers seem to fix my problem. I have a content div wrapped around a left floated image and a right floated table. I want the table to dictate the height to the content div instead of popping out of the bottom of the content div. Seems pretty simple but too complicated for me I...
21
6312
by: JOYCE | last post by:
Look the subject,that's my problem! I hope someone can help me, thanks
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.