Results 1 to 2 of 2
  1. #1
    cdolsen is offline Novice
    Windows XP Access 97
    Join Date
    Aug 2011
    Posts
    4

    fields not being setup correctly after changing from single-form to continious-form

    i have several forms that have fields filled in based on the contents of other fields on the form. when i set the form to single form everything is filled in correctly. when i change the form to continious form all the these related fields contain only the values related to the data on first form. when i have the same data on a report, i can get the correct data printed by using a requery in the print detail event.

    how can i get the correct data in the fields on the continious forms?

    my form displays all fields from a table.
    i use the primary key of the table as a reference to build other fields.

    i concatenate the id to build a disk address (ie - c:\dbdir\subdir\pid.bmp) to use as a source for an ole object.

    i use the same key to fill a listbox (ie - charlst.RowSource = "SELECT DISTINCTROW [peop-char].charid, char.seq, char.name, char.desc, char.notes FROM [peop-char] INNER JOIN [char] ON [peop-char].charid = char.id WHERE ((([peop-char].peopid)= pid))")



    i've tried coding these in all if the events for the form, the one working as the ON CURRENT event. the results are correct when i use a single form, everything being filled in. when i change it to continious forms the filled in fields are filled with data from the first table entry only.



    these are the called routines, 'pid' being the key of the table, and coded in a common module
    ===========
    Private Sub Form_Current()
    act_photo.Picture = setphoto("ppe", pid)
    charlst.RowSource = "SELECT DISTINCTROW [peop-char].charid, char.seq, char.name, char.desc, char.notes FROM [peop-char] INNER JOIN [char] ON [peop-char].charid = char.id WHERE ((([peop-char].peopid)= pid))"
    char_photo.Picture = ""
    If (charlst.ItemData(1) <> " " And charlst.ItemData(1) <> "") Then
    char_photo.Picture = setphoto("pch", charlst.ItemData(1))
    End If
    aclippath = setclip("ppe" & Right("000" & pid & "-0", 5))
    If (charlst.ItemData(1) <> " " And charlst.ItemData(1) <> "") Then
    cclippath = setclip("pch" & Right("000" & charlst.ItemData(1) & "-0", 5))
    End If
    On Error Resume Next
    complete.SetFocus
    End Sub
    ============
    Function setphoto(Optional pname As String, Optional p_pid As String) As String
    On Error Resume Next
    dskdir = setdir()

    If (p_pid <> "" And p_pid <> " ") Then
    t1 = "0000" & p_pid
    t2 = pname
    t3 = dskdir & "photos\" & t2 & Right(t1, 3) & "-0.*"
    t4 = Dir$(t3, vbDirectory)
    z2 = p_pid
    If t4 <> "" Then
    t5 = dskdir & "photos\" & t4
    Else
    t5 = dskdir & "photos\" & "none.bmp"
    End If
    End If
    mediapath = t5
    setphoto = t5
    End Function
    ===============
    Function setclip(Optional sname As String) As String
    On Error Resume Next
    dskdir = setdir()
    t2 = sname
    t3 = dskdir & "video\" & t2 & ".*"
    t4 = Dir$(t3, vbDirectory)
    If t4 <> "" Then
    t5 = dskdir & "video\" & t4
    Else
    t5 = "none exists in directory"
    End If
    mediapath = t5
    setclip = t5
    End Function
    ========
    Function setdir() As String
    On Error Resume Next
    Set cdb = CurrentDb()
    t1 = cdb.name
    t2 = ""
    t4 = ""
    t3 = ""
    i2 = Len(t1)
    For i1 = 1 To i2
    t2 = Mid$(t1, i1, 1)
    t3 = t3 & t2
    If Mid$(t1, i1, 1) = "\" Then
    t4 = t4 & t3
    t3 = ""
    End If
    Next i1
    dskdir = t4
    setdir = t4
    End Function
    ============

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Is there any reason you aren't calculating these fields in a query and basing the subform on that query? I don't think I see anything that can't be done in a query which would solve the problem I think.

    Hard to tell with no sample database but if you feel like supplying one we might be able to find a solution.

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

Similar Threads

  1. Single Form, Multiple Options
    By forrestapi in forum Forms
    Replies: 4
    Last Post: 06-30-2011, 07:09 AM
  2. Replies: 5
    Last Post: 03-17-2011, 06:21 AM
  3. Printing a single report from form
    By OFA in forum Forms
    Replies: 9
    Last Post: 06-08-2010, 09:27 AM
  4. Split Form not working correctly
    By Brian62 in forum Access
    Replies: 29
    Last Post: 02-16-2010, 05:43 PM
  5. Can't display fields correctly....
    By benjamin in forum Database Design
    Replies: 0
    Last Post: 05-17-2006, 03:43 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