Here's my scenario:
There's a form that is tied to one table (tblMainData) with 2 primary keys (ID and Date). Each record has a button on it so they can input a sales ticket, if anything was sold on that ID at that day.
If they have already put in the sales ticket and are going back to edit it, I want the recordset to pull up the existing records.
If no records exist, I want the recordset to be null, but to have the new values written into the table (tblSalesTicket). tblSalesTicket has 2 primary keys as well (ID and Date - these are brought over from tblMainData).
(I have not used a master table with master IDs, etc, for the reason that an ID may only have a sales ticket once every 90-200 days, and for the size of the project, it is just not currently necessary - if you think it is necessary, please let me know - I'm still learning on access forms/db structure.)
Now, currently I am pulling in the recordset as follows:
-tblSalesTicket-
This runs great. It pulls in the right records that are already listed in the table tblSalesTicket.
But when I add a record that doesn't exist already in the table, my numbers are not saved in the table.
Any clues on how to make this write to the table?
Thank you so much!
There's a form that is tied to one table (tblMainData) with 2 primary keys (ID and Date). Each record has a button on it so they can input a sales ticket, if anything was sold on that ID at that day.
If they have already put in the sales ticket and are going back to edit it, I want the recordset to pull up the existing records.
If no records exist, I want the recordset to be null, but to have the new values written into the table (tblSalesTicket). tblSalesTicket has 2 primary keys as well (ID and Date - these are brought over from tblMainData).
(I have not used a master table with master IDs, etc, for the reason that an ID may only have a sales ticket once every 90-200 days, and for the size of the project, it is just not currently necessary - if you think it is necessary, please let me know - I'm still learning on access forms/db structure.)
Now, currently I am pulling in the recordset as follows:
-tblSalesTicket-
Code:
Private Sub Form_Load()
Dim sqlCmd as String
sqlCheck = Select * from tblSalesTicket where (tblSalesTicket.WellID=" & Me.txtID & " AND tbsSalesTicket.TDate = " & "#" & Me.txtDate & "#" & ")"
Me.Recordsource = sqlCheck
Me.Requery
This runs great. It pulls in the right records that are already listed in the table tblSalesTicket.
But when I add a record that doesn't exist already in the table, my numbers are not saved in the table.
Any clues on how to make this write to the table?
Thank you so much!