Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AUTOFILL A SUBFORM

Status
Not open for further replies.

djeverett01

Programmer
Aug 24, 2001
16
US
I have a main form with several subforms. The main form has the client info. One of the subforms has the diagnosis for this client and the other subform has the problems that relate to the diagnosis.

What I want to do is automatically fill in the problems for a particular client based on their diagnosis. I have tried doing a query that contains all the info, but I run into a problem when a diagnosis has several problems that my query result are more than they should be.

So I am trying to autofill a subform with some data. The problem is that I keep getting a run-time error 3601. Too few parameters expect 1.

This is the code I am using, please help:

Dim Info As Recordset, SQLText1

If DCount("[PATIENT_ID]", "qryInputGoals") >= 1 Then
SQLText1 = "SELECT * FROM [qryInputGoals]WHERE [PATIENT_ID] = '" & Me![ClientID] & "'"
Set Info = CurrentDb.OpenRecordset(SQLText1)
Me![Problem] = Info![Problem]
End If

I get the error message at Set Info = CurrentDb.OpenRecordset(SQLText1)

Dawn Nelson Everett
 
if its any help to fill in a field within a subform you would use the following code:

forms![name of subform].[name of field]

hope this help
 
Thanks for the help.

I got the code to work. I think it had something to do with the references.

The problem I am having now is that if there are multiple records that need to be in the subform, the code only adds the first one. Does anyone know how to get it to look at the next record and write it too?

Dawn Nelson Everett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top