AnsweredAssumed Answered

How to get a 'current' record.

Question asked by JamesClark on Nov 29, 2010
Latest reply on Nov 29, 2010 by philmodjunk


How to get a 'current' record.


I'm building an equipment loans database I have the following tables Loans, inventory, kits and users I'm trying to create a script that will create a new loan record every time someone viewing an item in the inventory catalog clicks a 'check out' button.

Clicking the script currently, is supposed to do the following: go to the Loan layout and set some of the fields. The fields are corresponding fields to the inventory and users tables so that it contains a productID (unique auto entered number from inventory table) and the FullName of the user. It also contains other fields from which data is extracted from counterparts in other tables, it also records the date. 

Unfortunately it's not quite working out this way, for some reason every time a new loan record is created, a new inventory record is also created for some reason and this record contains no data about product names or anything except the product id and it is this that is sent to the corresponding product ID field in the new record in loans table. 

Also I don't know how to set it so that it takes the name of the current user, I've told it to get the data from the fullname field of the users table, but I don't know which record it will take it from. I think I can solve this problem by creating a value list of users and prompting the user to choose who is checking out a piece of equipment but the problem is there is other data besides full name that I would like extracted. Users have unique ID's but I don't know how to use this unique ID so that the script knows to pull all data from the user record (or inventory record too for that matter) that matches this. 

Ideally, one would find a piece of equipment from the catalogue, select one they want, press check out, be prompted for which user is checking out and have the correct information from both the record of the piece of equipment they were looking at in the catalogue (current inventory item) and the correct information from the user record matching that which they selected from the value list (current user).

I have a link to the file here if anyone wants to take a look at it for me. I'm a little stumped.