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
============