Add a new record, add details, then open that record?

Locopete99

Registered User.
Local time
Today, 14:24
Joined
Jul 11, 2016
Messages
163
Hi Guys,

I have a form, which I have called Frm_ShikomiregisterINT.

I have a command whereby when the user clicks on the button it adds a new record (to the table Tbl_ShikomiRegister) and fills out the salesmans name with their name, looked up from using the fOSUserName module.

Code:
Dim UR1 As String

UR1 = DLookup("[User Name]", "Tbl_User", "[login]= '" & fOSUserName & "'")


Set rsuser = CurrentDb.OpenRecordset("Tbl_ShikomiRegister", dbOpenDynaset)

With rsuser
     .AddNew
    ![Salesman] = UR1
    .Update

Once data is entered into the form, the autonumber ID (PK) is added to a descriptor ("GBS") and this is the records unique reference. This is saved in a field called Blanket Agreement Number.

The problem comes that what I want to happen is that once all this is done, the command then opens the form and shows this record.

Is there a way to store the blanket agreement number from the record created by the code above to then use this as the criteria for the open form command (opening Frm_ShikomiregisterINT)?
 
Thanks Minty
 

Users who are viewing this thread

Back
Top Bottom