Solved

Build Problems

Posted on 2002-06-14
9
137 Views
Last Modified: 2010-05-02
I have my app talking with SQL Server....

It works perfectly when I run it in build mode but then when I create the exe it hangs in various places such as after doing a recordset .update, it is supposed to display a message box.  In the build "run" it works, but in the .exe build it hangs where it should be displaying the message.

Any ideas?
0
Comment
Question by:baddogi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 1

Expert Comment

by:toys032498
ID: 7078662
Try putting a DoEvents prior to the message box.

0
 

Author Comment

by:baddogi
ID: 7078669
I've narrowed it down to the following code that is causing this:

'Msg = "Are You Sure You Want To Add This Department?"
'Style = vbYesNo + vbDefaultButton2
'title = "Confirmation"
'response = MsgBox(Msg, Style, title)


If I unrem this it hangs.....

Ideas?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 7078798
What code runs just before this?

mlmcc
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:baddogi
ID: 7078822
Here is the actual sub...

Sub Save_Click()

On Error GoTo errmsg:

Msg = "Are You Sure You Want To Add This Department?"
Style = vbYesNo + vbDefaultButton2
title = "Confirmation"
response = MsgBox(Msg, Style, title)
    If response = vbYes Then

    If txtdepartment.Text = "" Then
        MsgBox "Please Enter a Department Name"
    Exit Sub
    End If


With RS

.AddNew

!department = txtdepartment.Text


.Update

End With

MsgBox "Add Succeeded", vbOKOnly, "Status"
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True

ElseIf response = vbNo Then
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True
RS.Filter = adFilterNone
txtdepartment.Text = ""

Exit Sub
End If

Exit Sub

errmsg:

     MsgBox "Error # " & Str(Err.Number) & Chr(13) & Err.Description
         
Exit Sub
End Sub
0
 

Author Comment

by:baddogi
ID: 7078895
Here is the actual sub...

Sub Save_Click()

On Error GoTo errmsg:

Msg = "Are You Sure You Want To Add This Department?"
Style = vbYesNo + vbDefaultButton2
title = "Confirmation"
response = MsgBox(Msg, Style, title)
    If response = vbYes Then

    If txtdepartment.Text = "" Then
        MsgBox "Please Enter a Department Name"
    Exit Sub
    End If


With RS

.AddNew

!department = txtdepartment.Text


.Update

End With

MsgBox "Add Succeeded", vbOKOnly, "Status"
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True

ElseIf response = vbNo Then
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True
RS.Filter = adFilterNone
txtdepartment.Text = ""

Exit Sub
End If

Exit Sub

errmsg:

     MsgBox "Error # " & Str(Err.Number) & Chr(13) & Err.Description
         
Exit Sub
End Sub
0
 
LVL 4

Expert Comment

by:gencross
ID: 7079169
I think maybe your variable names are causing this.  I do not see any DIMs and Style is a keywork.  Try something like this...

Sub Save_Click()

Dim sMsg as string
Dim vStyle
Dim sTitle as string
Dim iResponse as integer

On Error GoTo errmsg:

sMsg = "Are You Sure You Want To Add This Department?"
vStyle = vbYesNo + vbDefaultButton2
sTitle = "Confirmation"
iResponse = MsgBox(sMsg, vStyle, sTitle)
0
 
LVL 4

Accepted Solution

by:
gencross earned 200 total points
ID: 7079174
I mean Style is a VB Keyword.  Whether or not this is the solution to your problem it is always good programming practice to prefix your variable names.  There are different naming conventions you can use :)
0
 
LVL 1

Expert Comment

by:toys032498
ID: 7079753
Nice job gencross!  I totally over looked that.

Thats why you should always use the following in the begining of every module.

Option Explict
0
 
LVL 4

Expert Comment

by:gencross
ID: 7083486
Thanks.  This one is easy to miss, and Option Explicit is the way to go:)

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month2 days, 19 hours left to enroll

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question