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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Autofill Data from Query or Other Form

Status
Not open for further replies.

njellis

IS-IT--Management
Joined
Jul 17, 2006
Messages
29
Thanks in advance for any help. I'm new to access and trying to learn up :)

I have Forms:
CustomerInfo
NewAppointment

The tables themselves are linked by CustomerID. So there is CustomerID and CustomerID in Appointments table.

I have the CustomerInfo form with a "Schedule Job" button, that opens the NewAppointment form. I want the CustomerID to automatically fill in, based off the "CustomerInfo" form thats open behind it.

I got that to work... sort of. In my CustomerID field of the NewAppointment Form, I had it =[Forms]![CustomerInfo]![CustomerID]

That Works! IT shows the CustomerID..... *BUT* it doesn't record it into the table once the data is saved. It just saves "0" in the CustomerID. **humpf**

Am I missing something?

SO -- I tried another route. I made a Query. The Query runs off the form CustomerInfo and has Criteria [Forms]![CustomerInfo]![CustomerID]

The report runs perfectly, it will have the customerID number of whatever I have open in the CustomerInfo form. BUT when I enter the query into the CustomerID for the form NewAppointment it just says #Name?

So I had = [NewAppointment_ID]![CustomerID] in the Control Source for the "CustomerID" record in the NewAppointments.


I hope that makes sense...

Basically, I want to pull data from Form1, have it import into Form2 (on open), and have the data in Form2 Save into Table1.


Thanks again everyone. Tek-Tips is great!
 
I suggest that you bind the CustomerID control on the Appointmnets form to the CustomerID field for the table, that is, just like a normal control. Then you can use code to fill in the control:

Code:
If Me.NewRecord Then
If CurrentProject.AllForms("CustomerInfo").IsLoaded Then
   Me.CustomerID=Forms!CustomerInfo!CustomerID
End If
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top