A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Error msg: The Command 'SaveRecord' isn't available - Help



 
 
Thread Tools Display Modes
  #1  
Old December 18th, 2008, 09:10 PM posted to microsoft.public.access.tablesdbdesign
Alu_GK
external usenet poster
 
Posts: 51
Default Error msg: The Command 'SaveRecord' isn't available - Help

Hello -
I'm running a code to send a record from my DB_A to DB_B.
The function "M_Valid_sMissingValAlert" checks whether the entire required
fields in the form were filled properly. It receives the form as reference
and the definition of the tag, which represents the required field (the "req"
is in the tag property enter by the programmer).
Me.sFKContact is the foreign key that supposes to be created in the DB_B.
M_AccountAPI_NewContactExport is the function the send the information to
the DB_B, it return the sFKContact (Foreign key from the DB_B, which is saved
in DB_A).
M_ErrMngr_RaiseErr is a function to handle Errors.

I activate the code with a botton " btnContactToCAS", and its stops in the
" DoCmd.RunCommand acCmdSaveRecord" line every time again.
The first error massage is "object not found "F_Contact" '|' ".
I don't understand it, because when I'm adding a new contact, and save it
(on the afterUpdate event), and the contact is not in DB_B alrealy, then
automatically the code goes to btnContactToCAS_Click and run the procedure
with 100% success.
So – What am I doing wrong here ???

Here is the code that I write.
Thanks !

'********************************************
Private Sub btnContactToCAS_Click()
On Error GoTo Err_btnContactToCAS_Click
Dim sMissingFields As String
sMissingFields = M_Valid_sMissingValAlert(Me.Form, "Req")
If Len(sMissingFields) 0 Then
GoTo Err_btnContactToCAS_Click
Else
DoCmd.RunCommand acCmdSaveRecord
If IsNull(Me.sFKContact) Or Me.sFKContact = 0 Then
Me.sFKContact = M_AccountAPI_NewContactExport("CAS",
Me.nContactIx)
Else
MsgBox "This Contact is already in DB_B", vbOKOnly +
vbInformation, "Contact In DB_B"
End If
End If

Exit_btnContactToCAS_Click:
Exit Sub

Err_btnContactToCAS_Click:
Call M_ErrMngr_RaiseErr(36, 4, err.Description & Chr(13) & Form.Name &
Chr(13) & sMissingFields, True, True)
Resume Exit_btnContactToCAS_Click
End Sub

'********************************************
Public Function M_Valid_sMissingValAlert(ByRef MyCurrentForm As Form,
sWordInTag As String) As String
'---------------------------------------------------------------------------------------
On Error GoTo Err_MissingValAlert
Dim TheForm As Form
Dim sMissingFields As String ' îçæé÷ Ã*ú äùãåú áäÃ* çñø òøê.
Dim ctlCurrentControl As Control
Set TheForm = MyCurrentForm
Set ctlCurrentControl = MyCurrentForm.Controls(0)
sMissingFields = ""

For Each ctlCurrentControl In TheForm.Controls
If ctlCurrentControl.ControlType = acTextBox Or
ctlCurrentControl.ControlType = acComboBox Then
If ctlCurrentControl.Tag = sWordInTag Then
If IsNull(ctlCurrentControl.Value) Then
If Len(sMissingFields) = 0 Then ' Concatenation of
the missing important fields
sMissingFields = ctlCurrentControl.StatusBarText
Else
sMissingFields = sMissingFields & ", " &
ctlCurrentControl.StatusBarText
End If
End If
End If
End If
Next ctlCurrentControl

M_Valid_sMissingValAlert = sMissingFields
Set TheForm = Nothing
Set ctlCurrentControl = Nothing

Exit_MissingValAlert:
Exit Function

Err_MissingValAlert:
Call M_ErrMngr_RaiseErr(32, 4, TheForm.Name & Chr(13) & err.Description,
True, True)
Resume Exit_MissingValAlert

End Function

--
Alu_GK
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.