Created MDE, Doesn't Like my Code?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

This code runs on the main forms drop down list for a customer, after
update.
After choosing a customer, then the list of clients for that customer would
be available.
It is necessary for it to run or else the client list will not be seen
correctly for the customer chosen.
Alternativley, I would have to save the record manually, then requery the
client list!
Here is my code, but after creating a mde, it errors out.
It says the command or action save isnt available now.
Is there anything else I can do?

DoCmd.RunCommand acCmdSave
Me.[Client ID].Requery
If err <> 2501 Then
MsgBox "Contact Tech Support"
End If
 
Dave Elliott said:
This code runs on the main forms drop down list for a customer, after
update.
After choosing a customer, then the list of clients for that customer would
be available.
It is necessary for it to run or else the client list will not be seen
correctly for the customer chosen.
Alternativley, I would have to save the record manually, then requery the
client list!
Here is my code, but after creating a mde, it errors out.
It says the command or action save isnt available now.
Is there anything else I can do?

DoCmd.RunCommand acCmdSave
Me.[Client ID].Requery
If err <> 2501 Then
MsgBox "Contact Tech Support"
End If

The acCmdSave is not for saving your record. It is for saving design
changes to the current form or report and this is not allowed in an MDE.
To save the current record use...

If Me.Dirty = True Then Me.Dirty = False
 
You can also try « DoCmd.RunCommand acCmdSaveRecord »; however, I don't know
if this will be allowed under MDE.

S. L.

Rick Brandt said:
Dave Elliott said:
This code runs on the main forms drop down list for a customer, after
update.
After choosing a customer, then the list of clients for that customer would
be available.
It is necessary for it to run or else the client list will not be seen
correctly for the customer chosen.
Alternativley, I would have to save the record manually, then requery the
client list!
Here is my code, but after creating a mde, it errors out.
It says the command or action save isnt available now.
Is there anything else I can do?

DoCmd.RunCommand acCmdSave
Me.[Client ID].Requery
If err <> 2501 Then
MsgBox "Contact Tech Support"
End If

The acCmdSave is not for saving your record. It is for saving design
changes to the current form or report and this is not allowed in an MDE.
To save the current record use...

If Me.Dirty = True Then Me.Dirty = False
 
Would I put this code on the after update like it was originally or the On
Dirty Event?

Rick Brandt said:
Dave Elliott said:
This code runs on the main forms drop down list for a customer, after
update.
After choosing a customer, then the list of clients for that customer would
be available.
It is necessary for it to run or else the client list will not be seen
correctly for the customer chosen.
Alternativley, I would have to save the record manually, then requery the
client list!
Here is my code, but after creating a mde, it errors out.
It says the command or action save isnt available now.
Is there anything else I can do?

DoCmd.RunCommand acCmdSave
Me.[Client ID].Requery
If err <> 2501 Then
MsgBox "Contact Tech Support"
End If

The acCmdSave is not for saving your record. It is for saving design
changes to the current form or report and this is not allowed in an MDE.
To save the current record use...

If Me.Dirty = True Then Me.Dirty = False
 
Dave Elliott said:
Would I put this code on the after update like it was originally or the On
Dirty Event?

Well if you are using AfterUpdate then you don't need to issue a save of
any kind. By definition the record is already saved in the AfterUpdate
event.
 
Back
Top