Results 1 to 7 of 7
  1. #1
    deepin125 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    8

    Empty textbox crash

    Strange issue with my access application. I have a backend with SQL server express 2008 r2, frontend Access 2010. I made an error checking procedure for when one of our offices disconnecting from our central server so that it will relink, then do an insert into the right table so they do not have to retype the information due to a disconnect. The Sql insert works fine, however if I do not enter a character into a particular text field it crashes and restarts the application. When it restarts the inserted portion is fine. If I enter a character into the text field it doesnt crash, it does the proper code, which closes the form and then opens the form. If I put a space character then delete it from the textbox, it works fine, if I enter anything into the field it works. Put nothing in yeilds a crash. I have compacted and repaired several times, I even debugged for 3 hours. Nothing looks wrong until it exits my form_errror sub-routine. Then it just crashes, with no error codes or anything.



    Any help would be super awesome! My last problem got solved very quickly. Is there some sort of error trapping I can do?

    Let me know!

    Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    It would help to see the code, but it sounds like you're not handling a Null value in that textbox. You may be able to use the Nz() function to make sure Null is not used.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    deepin125 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    8
    Thanks for the reply.

    I use the following code to deal with Nulls for this text box:

    If IsNull(Forms![Account Transaction List].Text425.value) Then
    varPN = ""
    Else
    varPN = Forms![Account Transaction List].Text425.value
    End If

    This works for the other null strings I put into the db.Execute sSQL:

    sSQL = "INSERT INTO [Transactions Extended] ([Insured Name], [Transaction],[Type of Policy], [Effective Date], [New Premium], [Source], [Producer], [CSR], [Comments], [Office], [From Company / To Company], [To Company], [Lost Premium], [Policy Number], [Date Keyed]) Values ('" & varIN & "','" & varTran & "','" & varTP & "',#" & varEF & "#," & varNP & ",'" & varSo & "','" & varPr & "','" & varCS & "','" & varCom & "','" & varOf & "','" & varFCTC & "','" & varTC & "'," & varLP & ",'" & varPN & "',#" & varDK & "#)"
    Debug.Print sSQL
    db.Execute sSQL, dbFailOnError
    Forms![Account Transaction List].Undo
    OpenClose "Account Transaction List"

    Thanks again.

  4. #4
    deepin125 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    8
    I have put this in the access forum because I think it is more likely a problem with a form in access then a SQL problem.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Step debug. Is varPN getting set?

    Is Policy Number field text datatype?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    deepin125 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    8
    It gets set to "", I have added a watch to the variable. I have stepped through using F8. The policy number is a text datatype.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Is the table field set to allow empty strings? I don't allow empty strings in tables.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access crash
    By Tjaaaa in forum Access
    Replies: 10
    Last Post: 03-07-2014, 05:41 PM
  2. Replies: 4
    Last Post: 11-20-2011, 01:08 PM
  3. Replies: 4
    Last Post: 06-29-2011, 06:32 AM
  4. Form Crash
    By AKQTS in forum Forms
    Replies: 3
    Last Post: 10-21-2010, 10:02 AM
  5. Query SQL Crash
    By Scorpio11 in forum Queries
    Replies: 1
    Last Post: 07-20-2010, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums