Hi John,
I understand what you are saying. Have already set this type of system up in
other areas so will look at the best way for me to do it in this instance.
In the meantime the following is the VB code that I wrote to try to make the
original idea work but it gets an error when I am trying to set the illnesses
table tag number field to that of the value in the form. Could you take a
look anyway and let me know why this is happening. I thought the forms etc
reference would do what I wanted. Hope this is understandable:
Private Sub SaveRecord_BeforeUpdate(Cancel As Integer)
Dim Cnxn As ADODB.Connection
Dim rstIllnesses As ADODB.Recordset
Dim strCnxn As String
Dim strSQL As String
Set Cnxn = New ADODB.Connection
strCnxn = "Provider='sqloledb';Data Source='MySqlServer';" & _
"Initial Catalog='Testing';Integrated Security='SSPI';"
Cnxn.Open strCnxn ('Testing' is the name of the Database as well as
the main table could this be causing a conflict?)
Set rstIllnesses = New ADODB.Recordset
strSQL = "Illnesses"
rstIllnesses.Open strSQL, strCnxn, adOpenKeyset, adLockOptimistic,
adCmdTable
rstIllnesses.AddNew
rstIllnesses.Tag Number = [Forms]![testing]![SaveRecord] (This is where
the error occurs)
rstIllnesses.Update
blnRecordAdded = True
rstIllnesses.Close
Cnxn.Close
End Sub
Sorry to be a pain.
Regards
Mabeline.