PC Review


Reply
Thread Tools Rate Thread

Code doesn't work but marcro does

 
 
Barry
Guest
Posts: n/a
 
      16th Jun 2004
Hello,

I have an application that opens a form using VBA which I
converted from a macro. It was working just fine, but
now for some reason, it doesn't - when I try to open the
form I get my error message. However, when I put the
macro back on the button, the form opens normally, so I
guess the problem is with the code (which compiles
properly). But the code was converted from a macro that
works, so I'm left scratching my head as to what the
problem is. Can someone explain to me what's happening
and help me solve this? Thanks in advance to anyone who
replies.
 
Reply With Quote
 
 
 
 
Newbie
Guest
Posts: n/a
 
      16th Jun 2004
can we have a clue about the code. . . . . and then we may be able to help
you
"Barry" <(E-Mail Removed)> wrote in message
news:1d79e01c453b7$c39a81e0$(E-Mail Removed)...
> Hello,
>
> I have an application that opens a form using VBA which I
> converted from a macro. It was working just fine, but
> now for some reason, it doesn't - when I try to open the
> form I get my error message. However, when I put the
> macro back on the button, the form opens normally, so I
> guess the problem is with the code (which compiles
> properly). But the code was converted from a macro that
> works, so I'm left scratching my head as to what the
> problem is. Can someone explain to me what's happening
> and help me solve this? Thanks in advance to anyone who
> replies.



 
Reply With Quote
 
Barry
Guest
Posts: n/a
 
      16th Jun 2004
Sorry... Here's the code. The user selects one of two
options, and the proper form opens. Thanks very much for
your help.

Private Sub OpEntSl_Click()
On Error GoTo OpEntSl_Click_Err

DoCmd.Close acForm, "fm_EntSelect3"
If (SelectEntitle = 1) Then
' Open Entitlement Definition1 form
DoCmd.OpenForm "fm_EntHist1",
acNormal, "", "[EENo]=[Forms]![fm_EEMaster]![EENo]", ,
acNormal
DoCmd.GoToControl "[ViewDetail]"
Forms!fm_EntHist1!Combo16.Enabled = False
End If
If (SelectEntitle = 2) Then
' Open Entitlement Definition2 form
DoCmd.OpenForm "fm_EntHist2",
acNormal, "", "[EENo]=[Forms]![fm_EEMaster]![EENo]", ,
acNormal
DoCmd.GoToControl "[ViewDet]"
Forms!fm_EntHist2!Combo15.Enabled = False
End If


OpEntSl_Click_Exit:
Exit Sub

OpEntSl_Click_Err:
MsgBox "No data", 0, "Argo"
Error$
Resume OpEntSl_Click_Exit

End Sub


>-----Original Message-----
>can we have a clue about the code. . . . . and then we

may be able to help
>you
>"Barry" <(E-Mail Removed)> wrote in

message
>news:1d79e01c453b7$c39a81e0$(E-Mail Removed)...
>> Hello,
>>
>> I have an application that opens a form using VBA

which I
>> converted from a macro. It was working just fine, but
>> now for some reason, it doesn't - when I try to open

the
>> form I get my error message. However, when I put the
>> macro back on the button, the form opens normally, so I
>> guess the problem is with the code (which compiles
>> properly). But the code was converted from a macro

that
>> works, so I'm left scratching my head as to what the
>> problem is. Can someone explain to me what's happening
>> and help me solve this? Thanks in advance to anyone

who
>> replies.

>
>
>.
>

 
Reply With Quote
 
John Vinson
Guest
Posts: n/a
 
      16th Jun 2004
On Wed, 16 Jun 2004 08:36:59 -0700, "Barry"
<(E-Mail Removed)> wrote:

>Hello,
>
>I have an application that opens a form using VBA which I
>converted from a macro. It was working just fine, but
>now for some reason, it doesn't - when I try to open the
>form I get my error message. However, when I put the
>macro back on the button, the form opens normally, so I
>guess the problem is with the code (which compiles
>properly). But the code was converted from a macro that
>works, so I'm left scratching my head as to what the
>problem is. Can someone explain to me what's happening
>and help me solve this? Thanks in advance to anyone who
>replies.


Care to post the code? I can't see it from here, so it's a bit
difficult to debug!

Note that the event property on the form design should show

[Event Procedure]

rather than the name of the macro.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA problem w Layout Reset. Manually stepped code gives good result. Run code doesn't work! Bob Microsoft Powerpoint 3 6th Nov 2008 09:17 PM
Marcro does not work when original workbook is deleted =?Utf-8?B?YWxsZXk=?= Microsoft Excel Programming 1 18th Aug 2005 03:13 PM
Re: Code works in one MDB, but corrupts. Code doesn't work in a new M John Nurick Microsoft Access VBA Modules 1 22nd Aug 2004 01:13 AM
why this code doesn't work? 71paolo71 Microsoft Excel Programming 7 6th May 2004 10:06 PM
code doesn't work ksnapp Microsoft Excel Programming 1 24th Mar 2004 05:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 PM.