A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Populate fields in Form Header based on header fields in startup f



 
 
Thread Tools Display Modes
  #1  
Old January 7th, 2005, 03:19 PM
Pat Dools
external usenet poster
 
Posts: n/a
Default Populate fields in Form Header based on header fields in startup f

Hello,

I have some code (see following) that will lookup to a table with Form name
and a number assigned to that form to open the 'next' form in a series via a
Command Button:

Sub OpenNextForm(strName As String)
Dim intOrder As Integer, frmName As String
On Error GoTo OpenNextForm_Err
intOrder = DLookup("[FormOrder]", "LU_Forms", "[FormName]= '" & strName
& "'")
frmName = DLookup("[FormName]", "LU_Forms", "[FormOrder]= " & intOrder
+ 1)
If Not IsNull(frmName) Then
DoCmd.OpenForm frmName, , , , acAdd
End If
DoCmd.Close acForm, strName
OpenNextForm_Err:
'MsgBox Err.Description
Resume Next
End Sub

ALL forms in the series have the same 4 fields in the Header section of the
form. The code opens the next Form in the series beautifully, but I would
like it to auto-populate the values of those 4 header fields to the values
set in the equivalent header fields in the first form of the series. I have
the following code, but no matter how I call it, I either get an error, or
the 4 header fields do not get auto-populated w/ no error message received
(where 'fScrEligCriteria' is the initial form and 'patient' is the unique
number assigned to the patient):

Sub SetAutoValues(frm As Form)
On Error GoTo SetAutoValues_err
' Set Automatic Values in each form in series
With frm
!studyday = Forms!fScrEligCriteria!studyday
!patient = Forms!fScrEligCriteria!patient
!pat_init = Forms!fScrEligCriteria!pat_init
!site = Forms!fScrEligCriteria!site
End With
SetAutoValues_err:
Resume Next
End Sub

Any ideas on how to BOTH navigate to next form in series and autopopulate
the 4 header fields by clicking on the Command Button would be greatly
appreciated.
--
Pat Dools
 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cursor Positioning Colin Hammond General Discussion 3 November 2nd, 2004 08:42 PM
No fields listed on my form in form view Nick Database Design 4 October 11th, 2004 04:48 AM
Automatically fill the fields on a form based on COMBO'S VALUE lin New Users 1 August 16th, 2004 11:55 PM
Filtering records in a form based on data in a subform or query. jbuck Using Forms 0 August 5th, 2004 02:51 PM
Can merge fields be entered into text form fields? Walt Mailmerge 5 May 18th, 2004 10:16 PM


All times are GMT +1. The time now is 04:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.