By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 2,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

Next Hireno

P: 49
Just a quick query, currently i have an hire form, when the form is opened the next hireno would automatically be displayed within this box. This works fine if i already have an order stored. But if i was to clear the hire table, so no hires are currently saved, i would like 1 to be displayed within the textbox when opened. but a message appears saying, no current record.

This is what i am using
Expand|Select|Wrap|Line Numbers
  1. Set rsitem = currentDatabase.OpenRecordset("tblhire")
  2. rsitem.MoveLast
  3. txthireno.Value = rstitem("hireno") + 1
The hire no in the table is a composite key with clientID. Is there a way in which it can automatically bring up 1 in the hire form when opened when it is part of a composite key? Hireno is currently autonumber
Mar 14 '08 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 2.5K+
P: 2,545
Hi. Why not just set the Default Value property of the textbox in your form to 1?

Mar 14 '08 #2

P: 49
It still brings up an error, i think because it is a composite key, it requires something to be in both the fields
Mar 14 '08 #3

Expert Mod 2.5K+
P: 2,545
It still brings up an error, i think because it is a composite key, it requires something to be in both the fields
Hi Goldstar. It wasn't until I read your other recent thread at that I realised you are not using standard methods of database design, and in particular you are trying to place multiple values into individual controls, for reasons that I can only guess at.

If there is a compound key involved you should as far as possible have the field values automated by an appropriate method (such as linking parent-child fields between a subform and a main form). It is never appropriate to have users enter compound key values themselves in a single text box.

There are useful examples of typical form/subform designs in the Northwind database that comes with Access. You will not find any that require users to enter compound key values in single textbox controls.

This is a different matter from displaying a compound key value (for example a year followed by a job number, 2008-105 say) where you can have a single text box displaying the value without expecting users to enter it that way.

Mar 14 '08 #4

P: 49
Thank you stewart the information provided is really useful.

By the way would you have a solution to my other query which was posted,

Mar 14 '08 #5

Post your reply

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