Help required please

OMG. Your teaching this in a class not specifically about access???

It sounds like you should be focusing on the principles of a relational database, rather than intermediate level queries.

As for your question



int() returns the integer portion of a number
rnd() returns a random integer

So this is returning the integer part of 1000+(random#*8999)



Create a query. Add the table in question. Add the autonumber. Group by Max. In the next column, create a calculated row which is ["Name of autonumber Field Here"]+1

Thanks for your help. I don't propose to boast to know about Access inside out, and i don't let my students believe this either, however every one has to learn somewhere as i'm sure you all did. With me i've never needed to deliver databases to such a level before and as its the first time i'm teaching this i have come across some things that i don't know so i'm asking for assistance. And yours was warmly welcomed!!
 
int() returns the integer portion of a number
rnd() returns a random integer
Not quite...

rnd() returns a random double number between 0 and 1

So this is returning the integer part of 1000+(random#*8999)
This is right though...
i.e.
0.5 * 8999 = 4499.5
Int() then makes that 4499
1000 + 4499 = 5499 as your number part

Create a query. Add the table in question. Add the autonumber. Group by Max. In the next column, create a calculated row which is ["Name of autonumber Field Here"]+1

If you have the autonumber field on your data entry form, you can retrieve the new number via: Me.AutoNumberField

Again I am FIRMLY against making this key AND firmly against storing it if you do incist on making it.
Offcourse the task at hand requires you to make it, but if this were a real world customer I would argu profusely against using this.

Instead just use an Autonumber field as your (stored) primary key. Then where/when needed create the "surogate key" XXX9999 when ever needed using the function you nearly had in your post #29

Good luck Teach !
 
Hi another question if i may :)

I have a form that collects customer data. The form when runs a macro that inturn open two queries. The first query creates a new customer and the second updates a booking table. However my question is is there any way of getting the Customer id into the form automatically from the query that creates a new customer?
 
Hi another question if i may :)

I have a form that collects customer data. The form when runs a macro that inturn open two queries. The first query creates a new customer and the second updates a booking table. However my question is is there any way of getting the Customer id into the form automatically from the query that creates a new customer?

Its ok I managed to sort it. Thanks to everyone who helped out on this i really have come along way in databases.
 

Users who are viewing this thread

Back
Top Bottom