473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Next Hireno

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
4 1343
Stewart Ross
2,545 Expert Mod 2GB
Hi. Why not just set the Default Value property of the textbox in your form to 1?

-Stewart
Mar 14 '08 #2
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
Stewart Ross
2,545 Expert Mod 2GB
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 http://www.thescripts.com/forum/thread780473.html 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.

-Stewart
Mar 14 '08 #4
Thank you stewart the information provided is really useful.

By the way would you have a solution to my other query which was posted, http://www.thescripts.com/forum/thread780473.html

Thanks
Mar 14 '08 #5

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

Similar topics

3
by: Marcel | last post by:
Hello, I'm working on a search application for my website. The website contains a lot of pictures, and a search should return clickable thumbnails. No problems there. My problem started when I...
2
by: Bengt Richter | last post by:
Is this a well known bug that's been fixed? I couldn't find any discussion of it, but maybe my googling's off today ;-/ >>> def foo(): ... it = iter(range(10)) ... while True: ... ...
7
by: simonwittber | last post by:
>>> gen = iterator() >>> gen.next <method-wrapper object at 0x009D1B70> >>> gen.next <method-wrapper object at 0x009D1BB0> >>> gen.next <method-wrapper object at 0x009D1B70> >>> gen.next...
2
by: Deniz Bahar | last post by:
Hi, I'm working with a single linked list and want to delete elements by searching through the list (starting form the HEAD) then finding the element, then doing the following: NewElement =...
13
by: Joseph Garvin | last post by:
When I first came to Python I did a lot of C style loops like this: for i in range(len(myarray)): print myarray Obviously the more pythonic way is: for i in my array: print i
7
by: fniles | last post by:
In VB 6.0 in the error trapping, we can do "resume next" to continue on the next code. How can we do that in .NET with "Try", "Catch","End Try" ? Thanks
4
by: Neo | last post by:
I found on error resume next doesn't work in for each... e.g. on error resume next for each x in y 'do stuff next if you have an error in for each loop, it falls in infinite loop... it...
0
ADezii
by: ADezii | last post by:
If you want to visit each item in an Array, you have two alternatives: Use a For Each..Next loop, using a Variant to retrieve each value in turn. Use a For...Next loop, looping from the Lower...
2
ADezii
by: ADezii | last post by:
If you are executing a code segment for a fixed number of iterations, always use a For...Next Loop instead of a Do...Loop, since it is significantly faster. Each pass through a Do...Loop that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.