Hi,
This may sound like a silly question but I've searched and searched but still could not find an answer to my question.
I have a form that is bound to a table (tblOrdersTemp). The purpose of this form is for the user to enter several different orders all at once and then it will update all these orders to the tblOrdersMain table and all the entries in the tblOrdersTemp will have the same main order number, and differentiated with different subOrder numbers.
Eg: Client comes into shop, does 5 orders all at once. These 5 orders will be placed in tblOrdersTemp. Once all details for the 5 orders are completed, these records will be moved out of tblOrdersTemp and placed in tblOrdersMain, with order number as Order001-00, Order001-01, Order001-02, Order001-03, Order001-04
I want to create my own navigation buttons on the form because the ones offered by access is not what I want. I want it so that the form will not show a blank form until I press the "ADD NEW" button. With the buttons offered by access, it will show a blank form if I press "NEXT" (provided I am on the last record). This is why I thought of using recordsets (but I must admit I am a newbie to access and haven't really used recordsets before).
I placed the following code in the Form_Load event:
Dim myConnection as ADODB.Connection
Set myConnection = CurrentProject.Connection
Dim myRecordset as New ADODB.Recordset
myRecordSet.activeConnection = myConnection
myRecordset.Open “tblOdersTemp”, , adOpenStatic, adLockOptimistic
However, when I put command button on the form and tried to use "myRecordset.moveNext", it wouldn't work and said "Object variable not found". I am guessing that's because I have not declared myRecordset in the command button sub procedure? But if I declare it again, wouldn't it be different to recordset I've declared in the form load event? Or am I missing something completely?
I have thought of using the DoCmd method, but the moveNext method will still give a blank form, which is not what I want. I want it to show a blank form ONLY if the user presses the "ADD NEW ORDER" button. Furthermore, I want records to be updated in the tblOdersTemp table ONLY if the user presses the "SAVE THIS ORDER" button.
Any help would be greatly appreciated.
Thanks all.
This may sound like a silly question but I've searched and searched but still could not find an answer to my question.
I have a form that is bound to a table (tblOrdersTemp). The purpose of this form is for the user to enter several different orders all at once and then it will update all these orders to the tblOrdersMain table and all the entries in the tblOrdersTemp will have the same main order number, and differentiated with different subOrder numbers.
Eg: Client comes into shop, does 5 orders all at once. These 5 orders will be placed in tblOrdersTemp. Once all details for the 5 orders are completed, these records will be moved out of tblOrdersTemp and placed in tblOrdersMain, with order number as Order001-00, Order001-01, Order001-02, Order001-03, Order001-04
I want to create my own navigation buttons on the form because the ones offered by access is not what I want. I want it so that the form will not show a blank form until I press the "ADD NEW" button. With the buttons offered by access, it will show a blank form if I press "NEXT" (provided I am on the last record). This is why I thought of using recordsets (but I must admit I am a newbie to access and haven't really used recordsets before).
I placed the following code in the Form_Load event:
Dim myConnection as ADODB.Connection
Set myConnection = CurrentProject.Connection
Dim myRecordset as New ADODB.Recordset
myRecordSet.activeConnection = myConnection
myRecordset.Open “tblOdersTemp”, , adOpenStatic, adLockOptimistic
However, when I put command button on the form and tried to use "myRecordset.moveNext", it wouldn't work and said "Object variable not found". I am guessing that's because I have not declared myRecordset in the command button sub procedure? But if I declare it again, wouldn't it be different to recordset I've declared in the form load event? Or am I missing something completely?
I have thought of using the DoCmd method, but the moveNext method will still give a blank form, which is not what I want. I want it to show a blank form ONLY if the user presses the "ADD NEW ORDER" button. Furthermore, I want records to be updated in the tblOdersTemp table ONLY if the user presses the "SAVE THIS ORDER" button.
Any help would be greatly appreciated.
Thanks all.