Using unbound form to update an unrelated table

24 Views Asked by At

I have two forms one is called "Form1" with nine unbound Textboxes (txtbox1 - txtBox9) and a command buttom called "cmd_CustINFO". "Form1" is not related to "tbl_Master1" which is the record source for "Form2". When all the unbound textboxes are filled and the cmd_CustINFO is pushed in "Form1" it opens "Form2" with related record(s) matching the values of the unbound textboxes, but if no record matches the values of the unbound textbaoxes in "tbl_Master1" it triggers a Yes/No error message that asks if user would like to manually add the record.

The event I would like to create is if user presses "YES" I need the values of the (txtbox1 - txtBox9) unbound textboxes from "Form1" to be saved to "tbl_Master1" and "Form2" to open with that saved record.

Could somebody help me to achieve this with a code?

I really appreciate your help!

I have the following:

MsgBox "No Record found. Do you want ti manually add the record?"

Dim db As Database
Dim RS As Recordset
Set db = CurrentDb
Set RS = db.OpenRecordset("tbl_Master1")
    
With RS 
    .AddNew
    [txtBox1] = Me.Store.value (This is the mathing record in "tbl_Master1"
    [txtBox2] = Me.Account.value 
    [txtBox3] = Me.Statement.value 
          "
          "
End With

The above has not worked well for me. it did not add the values from the txtboxes in "Form1", so the desired "Form2" opened but with NO record.

I am hoping to get a better recommendation on how to proceed. All assistance would be greatly appreciated.

0

There are 0 best solutions below