StormcrowRahl
IS-IT--Management
I need to get the primary key for a record and place it into a variable to pass to a form. I am thinking that I should either create a module to do this when the form opens or just add the code into the Form.Open section of the form code. I just don't know how to not only find the record via vba, but how to grab just one specific column of the record and put it into a variable.
To give you a bit more understanding of why I am wanting to do this, I am using a 2 table system to essentially create session ids. When the form opens I want it to grab the currentuser and the date & time and create a record in the tblsession table. Once that record is created, I want to grab that new record's primary key and place it into a variable. Then I can use that variable to automatically fill in the control on the form to fill in the foreign key field in the main table(tblmain). I want to do this to be able to run reports for the work done during the current session by a specific user. Thanks in advance for any help.
To give you a bit more understanding of why I am wanting to do this, I am using a 2 table system to essentially create session ids. When the form opens I want it to grab the currentuser and the date & time and create a record in the tblsession table. Once that record is created, I want to grab that new record's primary key and place it into a variable. Then I can use that variable to automatically fill in the control on the form to fill in the foreign key field in the main table(tblmain). I want to do this to be able to run reports for the work done during the current session by a specific user. Thanks in advance for any help.