Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 8th, 2008, 11:29 AM
Authorized User
Join Date: May 2007
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code help - Form misbehaving

Can someone please tell me what is going wrong with this code. It happens periodically. Even though there is a request on another form in the form of

docmd.openform "frmname"
Forms!frmname.recordsource = strsql

However for some reason new record is being activated.

Private Sub Form_Load()

    'set the error trap
    On Error GoTo errorhandler

    'transfer the name of the calling form
    callform = gstrcallingform
    'clear the global calling form holder
    gstrcallingform = ""
    'reset the btnclick
    btnclick = False

    'check if it is a new record
    If Me.NewRecord = True Then
        'it is so reset the risk counter
        priskval = 0
        'set the risk level to low on screen
        Me.productrisk.Value = "Low"

        'set the risk counter for the appropriate level of risk
        Select Case Me.productrisk.Value
            Case "Low"
                priskval = 1
            Case "Medium"
                priskval = 3
            Case "high"
                priskval = 4
        End Select
    End If


    'set the option field to show case details
    Me.optfileinspect.Value = 1
    'call the frame selection routine
    Call optfileinspect_AfterUpdate
    'move the focus to the ar firm name

    Exit Sub

    generalerrorhandler Err.Number, Err.Description, ffile, "form_load"
    Resume exitld

End Sub

Reply With Quote
  #2 (permalink)  
Old May 13th, 2008, 06:26 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Can you do this:

Other Form Code:
docmd.openform "frmname"

On Load of the new form:
Me.recordsource = strsql

Declare strsql as a Public variable in a module to pass the value to the opening form. Although I think you can only requery controls, not forms.

Is that where the problem is?


Look it up at: http://wrox.books24x7.com
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh form code CrArC Access VBA 1 October 28th, 2006 08:57 AM
Missing +/or Misbehaving Calendar Control Caratman Excel VBA 0 March 5th, 2006 12:57 PM
Database Misbehaving SerranoG Access 2 February 15th, 2005 08:59 AM
InputBox Misbehaving bph Access 10 March 4th, 2004 01:09 PM
Help with Form Code BryanBrassell Access VBA 2 August 18th, 2003 02:34 PM

All times are GMT -4. The time now is 01:38 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.