Hello folks,
I have a an unbound popup form (popNewCustomer) that allows the input of data into a Customer Table (tblCustomers).
Once the form has been completed, I have a sub that puts the completed forms data into the table via an SQL Insert. All good.
The form then closes.
I'd like to automatically navigate to the record in question in the (always open) main form (frmMainDisplay) - but because I'm using SQL to insert the record, I don't know it's CustomerID. I do have a plethora of information to the tune of the variables I've just inserted - but no ID.... (Here's the SQL - the "var$$$$$" outputs the variable with single quotes so SQL can deal with it.
So, in summary, I just need to either navigate to the latest created record or the record relating the one just made.
Can anyone help me please?
I have a an unbound popup form (popNewCustomer) that allows the input of data into a Customer Table (tblCustomers).
Once the form has been completed, I have a sub that puts the completed forms data into the table via an SQL Insert. All good.
The form then closes.
I'd like to automatically navigate to the record in question in the (always open) main form (frmMainDisplay) - but because I'm using SQL to insert the record, I don't know it's CustomerID. I do have a plethora of information to the tune of the variables I've just inserted - but no ID.... (Here's the SQL - the "var$$$$$" outputs the variable with single quotes so SQL can deal with it.
Code:
trSQLstatement = "" ' to be sure it starts blank
strSQLstatement = strSQLstatement & "INSERT INTO tblCustomers ( CompanyName, AddressL1, AddressL2, AddressL3, City, PostalCode, MainTel, MainFax, InceptionDate, BoolClient) "
strSQLstatement = strSQLstatement & "SELECT " & varCustomer & " AS CompanyName, "
strSQLstatement = strSQLstatement & varAddrL1 & " AS AddressL1, "
strSQLstatement = strSQLstatement & varAddrL2 & " AS AddressL2, "
strSQLstatement = strSQLstatement & varAddrL3 & " AS AddressL3, "
strSQLstatement = strSQLstatement & varCity & " AS City, "
strSQLstatement = strSQLstatement & varPostcode & " AS PostalCode, "
strSQLstatement = strSQLstatement & varTel & " AS MainTel, "
strSQLstatement = strSQLstatement & varFax & " AS MainFax, "
strSQLstatement = strSQLstatement & varInception & " AS InceptionDate, "
strSQLstatement = strSQLstatement & varClient & " AS BoolClient"
So, in summary, I just need to either navigate to the latest created record or the record relating the one just made.
Can anyone help me please?