Results 1 to 2 of 2
  1. #1
    AdventureBob is offline Novice
    Windows Vista Access 2007
    Join Date
    Nov 2011
    Location
    kabul
    Posts
    13

    Passing from form to form

    Ok, Id pull my hair out if I had any. I know this easy but man, Im struggling.

    Ok so I open a form form the results of another by passing it a filter. I want to add a new record with the ID the same as the filter. Previously the ID was numeric, now it has Alpha Characters. When I go to the new rec and insert the filter value I get single quotes on either side of the value. How do I get rid of the *&^%&^$% single quotes?

    I use a button to add a record utilizing the follwoing code:

    Private Sub AddRecBtn_Click()
    On Error GoTo Err_AddRecBtn_Click
    Dim FieldVal As String
    Me.AllowAdditions = True


    FieldVal = Me.Filter


    FieldVal = Mid$([FieldVal], (InStr(1, [FieldVal], "=") + 1), Len([FieldVal]))

    DoCmd.GoToRecord , , acNewRec
    Me!CaseNumProcessRef = FieldVal
    Me!Step.SetFocus
    Me.AllowAdditions = False

    Exit_AddRecBtn_Click:
    Exit Sub
    Err_AddRecBtn_Click:
    MsgBox Err.Description
    Resume Exit_AddRecBtn_Click

    I know this isnt that difficult but man I cant seem to get ther from here.
    BC

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    A form/subform arrangement would eliminate code.

    Don't know why the code carries over apostrophes. Would have to analyze project. Can remove them with: Replace(FieldVal, "'", "")
    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. passing variable from modal form to main form
    By crowegreg in forum Forms
    Replies: 2
    Last Post: 06-03-2011, 05:34 PM
  2. Passing Data From One Form to Another Form
    By ETCallHome in forum Forms
    Replies: 6
    Last Post: 03-12-2011, 12:53 PM
  3. Passing value from one form to another
    By Molly152 in forum Forms
    Replies: 4
    Last Post: 11-16-2010, 11:03 AM
  4. Replies: 10
    Last Post: 09-27-2010, 08:06 PM
  5. Passing current form name to other form
    By owiec in forum Forms
    Replies: 2
    Last Post: 11-15-2009, 05:50 AM

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