SirTKC
asked on
MS ACCESS 2007 - "You Can't save this record at this time"
Hi again :-)
Now here is where I am trapped...
I have the code below that works well excepted that when I try to close my form, I get an error message saying: "You Can't save this record at this time"
I do know that it has something to do with my RecordSet not properly set, because it started to appear as soon as I added it.
My goal is very simple, I need to use one variable located in another table in order to complete the calculation. See "SELECT"
Is there a better way to achive this & (more simple - no mistake) ?
I did try my best ;-/
Now here is where I am trapped...
I have the code below that works well excepted that when I try to close my form, I get an error message saying: "You Can't save this record at this time"
I do know that it has something to do with my RecordSet not properly set, because it started to appear as soon as I added it.
My goal is very simple, I need to use one variable located in another table in order to complete the calculation. See "SELECT"
Is there a better way to achive this & (more simple - no mistake) ?
I did try my best ;-/
Private Sub Form_AfterUpdate()
On Error GoTo Err_Handler
Dim TheBox As String
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim RS As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT DesignMaterials.M_Name, DesignMaterials.M_Poid " & _
"FROM DesignMaterials " & _
"WHERE (((DesignMaterials.M_Name)= '" & Me.D_Mat & "' ));"
Set RS = CurrentDb.OpenRecordset(strSQL)
TheBox = Me.Box_Name.Value
x = Me.D_Long.Value
y = Me.D_Larg.Value
z = Me.D_Haut.Value
Select Case TheBox
Case "Filler"
Me.EmbPoids.Value = (((x * y * 2) + (z * y * 2)) / 144) * RS!M_Poid
Case "Régulière"
Me.EmbPoids.Value = (((x * y * 2) + (z * y * 2) + (((x / 2) * z) * 4) + (((z / 2) * x) * 4)) / 144) * RS!M_Poid
Case "Semi-régulière"
Me.EmbPoids.Value = (((x * y * 2) + (z * y * 2) + (((x / 2) * z) * 2) + (((z / 2) * x) * 2)) / 144) * RS!M_Poid
End Select
RS.Close
Set RS = Nothing
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, , "cmdDupe_Click"
Resume Exit_Handler
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think I have coded too much today...
Thanks a million !!!