From: Iram on
The vba is good for now as far as changing the form to Data Entry to Yes,
however the RecordID is not = RecordID on the form that is opening. If there
is nothing wrong with the vba below then it must be a problem somewhere else.
Can you take another look?



Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_AltaDeRegistrosPagina1-2Analista"
stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms(stDocName).DataEntry = False


End Sub


Thanks.
Iram



"Rick Brandt" wrote:

> Iram wrote:
>
> > Hello,
> > Below is vba on the On Click of a command button that is used to open a
> > form called "frm_AltaDeRegistrosPagina1-2Analista", match the Record ID to
> > the local form's Record ID, then make the "Data Entry" attribute = No. For
> > some reason it is not working correctly. I need the vba to change the
> > "Data Entry" attribute = No, so that I can modify the data on that form.
> > The said form above is usually used to add records using the "Data Entry"
> > attribute and via
> > using the switchboard "Add Record" setting. Now I need to access the same
> > form to modify records. Can you help me fix the below vba and could you
> > also type up vba for me to put on the "On Close" of the form so that the
> > vba sets the "Data Entry" setting back = Yes?
> >
> > Private Sub ModificarRegistrante_Click()
> >
> > Dim stDocName As String
> > Dim stLinkCriteria As String
> >
> > stDocName = "frm_AltaDeRegistrosPagina1-2Analista"
> > DoCmd.OpenForm stDocName, , , stLinkCriteria
> > stLinkCriteria = "[RecordID]=" & Me![RecordID]
> > Forms(stDocName).DataEntry = False
> >
> > End Sub
>
> You need to set the value of stLnkCriteria *before* you use it. And with a
> WHERE clause you don't need to mess with the DataEntry property at all.
>
> Private Sub ModificarRegistrante_Click()
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "frm_AltaDeRegistrosPagina1-2Analista"
> stLinkCriteria = "[RecordID]=" & Me![RecordID]
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> End Sub
>
> .
>
From: Piet Linden on
On Jun 6, 11:17 am, Iram <I...(a)discussions.microsoft.com> wrote:
> The vba is good for now as far as changing the form to Data Entry to Yes,
> however the RecordID is not = RecordID on the form that is opening. If there
> is nothing wrong with the vba below then it must be a problem somewhere else.
> Can you take another look?
>
>      Dim stDocName As String
>      Dim stLinkCriteria As String
>
>      stDocName = "frm_AltaDeRegistrosPagina1-2Analista"
>      stLinkCriteria = "[RecordID]=" & Me![RecordID]
>      DoCmd.OpenForm stDocName, , , stLinkCriteria
>      Forms(stDocName).DataEntry = False
>
> End Sub
>
> Thanks.
> Iram
>
> "Rick Brandt" wrote:
> > Iram wrote:
>
> > > Hello,
> > > Below is vba on the On Click of a command button that is used to open a
> > > form called "frm_AltaDeRegistrosPagina1-2Analista", match the Record ID to
> > > the local form's Record ID, then make the "Data Entry" attribute = No. For
> > > some reason it is not working correctly. I need the vba to change the
> > > "Data Entry" attribute = No, so that I can modify the data on that form.
> > > The said form above is usually used to add records using the "Data Entry"
> > > attribute and via
> > > using the switchboard "Add Record" setting. Now I  need to access the same
> > > form to modify records. Can you help me fix the below vba and could you
> > > also type up vba for me to put on the "On Close" of the form so that the
> > > vba sets the "Data Entry" setting back = Yes?
>
> > > Private Sub ModificarRegistrante_Click()
>
> > >     Dim stDocName As String
> > >     Dim stLinkCriteria As String
>
> > >     stDocName = "frm_AltaDeRegistrosPagina1-2Analista"
> > >     DoCmd.OpenForm stDocName, , , stLinkCriteria
> > >     stLinkCriteria = "[RecordID]=" & Me![RecordID]
> > >     Forms(stDocName).DataEntry = False
>
> > > End Sub
>
> > You need to set the value of stLnkCriteria *before* you use it.  And with a
> > WHERE clause you don't need to mess with the DataEntry property at all.
>
> >  Private Sub ModificarRegistrante_Click()
>
> >      Dim stDocName As String
> >      Dim stLinkCriteria As String
>
> >      stDocName = "frm_AltaDeRegistrosPagina1-2Analista"
> >      stLinkCriteria = "[RecordID]=" & Me![RecordID]
> >      DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> >  End Sub
>
> > .

wow. Didn't they just tell you that it's the OpenForm that's wrong?
One of the arguments of the OpenForm method is which mode to open the
form in - edit/add/read only... and you didn't pick one. If you
don't, it defaults to read/write.

DoCmd.OpenForm stDocName, acNormal, , , acFormReadOnly, acWindowNormal

It's just amazing what you can do if you actually start typing the
code ... IntelliSense actually gives you all the arguments you need...
you just have to pick them. Try scraping the cobwebs outta your head
and using it....

First  |  Prev  | 
Pages: 1 2
Prev: Forms acting strange.
Next: Combo box causes crashes