none
Masks with multiple instances. RRS feed

  • Question

  • Masks with multiple instances.

    Instance form creation:
    Set frmInstance = New Form_AnagraficaAziendeDettaglio
    frmInstance.Visible = True
    MyFrmCollection.Add Item: = frmInstance, Key: = CStr (frmInstance.hWnd)
    Set frmInstance = Nothing

    Temporary table creation:
    azSQL = "SELECT * INTO tmp_SYS_AnagraficaAziende" & Key & "FROM dbo_SYS_AnagraficaAziende WHERE Id = '" & IdRec & "'"
    CurrentDb.Execute azSQL, dbFailOnError
    At this point I need to associate the temporary table created with the instance of the form.
    frmInstance.RecordSource does not work or better when editing the record in the mask, the table does not go into edit.
    How can I do?

    Thanks

    Thursday, January 4, 2018 6:09 PM

All replies

  • Hi Bertelli.Davide,

    from the description of the thread , I can see that you fire a select query and want to load that data to form to edit it.

    you cannot update the data directly using form when you bring the data using select query.

    here, you can add some code to your form which selects the data and then you can show that data using unbound controls on the form.

    further you can edit the data and again fire a update query to modify that data.

    below is example code:

    Option Compare Database
    
    Private Sub Command4_Click()
     Dim strSQL1 As String
       
      
        Set db = CurrentDb
    
        strSQL1 = "update emp_data set e_name='" & Me.Text2.Value & "' where id=" & Me.Text0.Value & ";"
        db.Execute strSQL1, dbFailOnError
        MsgBox ("Record Updated Successfully...")
    End Sub
    
    Private Sub Form_Load()
    Dim SQL As String
    Dim db As Database
    Dim rs As DAO.Recordset
    
    SQL = "select * from emp_data where id = 1;"
    Set db = CurrentDb
    Set rs = db.OpenRecordset(SQL)
    
    Me.Text0.Value = rs!ID
    Me.Text2.Value = rs!e_name
    
    Set rs = Nothing
    Set db = Nothing
    End Sub
    

    Data in Table:

    when you run the form data get fetch using select query and you can modify it on button click by fire an update query.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 5, 2018 2:08 AM
    Moderator
  • Hi Bertelli.Davide,

    Is your issue resolved?

    I find that, After creating this thread, You did not done any follow up on this thread.

    If your issue is solved then I suggest you to share your solution and mark it as an answer.

    If your issue is still persist then I suggest you to refer the suggestions given by the community members may help you to solve your issue.

    If then after you have any further questions then you can let us know about it.

    We will try to provide further suggestions to solve it.

    I suggest you to update the status of this thread. This thread is still open and will remain open until you mark the answer.

    So take appropriate steps to close this thread , If your issue is resolved.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 18, 2018 9:09 AM
    Moderator