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

Add command

Status
Not open for further replies.
Sep 16, 2005
191
US
Anyone know the code for to add. I have a form and it display user information and within that form, I have a Seminar subform with display any seminar they have attended.

I have an update seminar command button. Once I click on this button, it brings up a form that display all the seminars. So when I select the seminar and hit the add button, it should update the Seminarsubform.

Any idea how?
 
A bit vague. This is what I think it says: it should add a record for someone who attented a seminar to his list of already attended seminars? But why then use the commandbutton. Why not add combox to seminarsubform wiht all the seminars in it.... Or maybe I just misunderstand.

Pampers [afro]
Just let it go...
 
You are right. Okay.. So if I add the combox, how will the record I selected be added to the seminar sub form?
 
I think your form looks like:
Mainform has UserInfo (1-record)
Subform has Attented Seminars (n-recors)

If so, you place a combox that is populated by the seminars table on your subform. Everytime you select a seminar for that person from the combo a new record is created.

I also did made a little vba-code for inserting a record by double clicking on the desired Seminar (this forms comes up after your command button}

Code:
Private Sub SeminarName_DblClick(Cancel As Integer)
    Value1 = Forms.Mainform.ContactID
    Value2 = Me.SeminarID

Dim sql As String
sql = "INSERT INTO tblAttend (ContactID, SeminarID) " & _
      "VALUES (" & Value1 & "," & Value2 & ");"
CurrentDb.Execute (sql)
Forms.Mainform.Requery
End Sub

Pampers [afro]
Just let it go...
 
Thanks so much for assisting. You are right about how my form look.
Let me get this clear:

MainForm (Participant):

Name: John Smith Title: Business Analyst

subform (Class Attendee)
Year Taken: 2004
Classes: Project Analyst
----
?? with this Class Attendee, create a combox box? like below:
subform (Class Attendee)
Year Taken: 2004
Classes: Project Analyst

Combox : Class Name, Date, Time, Location
 
Mainform
fieldParticipant (textbox)

Subform, with the fields
class/seminar taken (from combox - these are in a separate table)
year taken (textbox/date)
location (textbox)

the main and subform are linked on ParticipantID

Pampers [afro]
Just let it go...
 
I am so dumb. I don't understand. I cannot get it to work. Maybe if I tell you what table I have you can better assist me with my form design.

I have 3 table:
tblAttendee (AUserID, ALastName,AFirstName,ARole)- attendee info

tblCourse (CCourseID,CCourseName,CDate) - list of all course need to take, total 13 class.
tblUserWithCourse (UUserID,UCourseID,UYearTaken) - list of users with courses they already taken.

My form:
I want to display the all tblAttendee inform on this form as well as course they have taken. So when I go to a user that have not taken any courses, the main form will display just the user information.

I also wanted to be able to update the tblUserWithCourse table when I select a course from somewhere???

 
mommom,

Problem:
When you "click" on the update seminar command button it then brings up a form that displays all the seminars. You then select the seminar of choice and "click" on the ADD button. It should update the Seminarsubform (but, sounds like it isn't).

Possible Solution:
You might want to check the VB/Module code for the ADD button. Specifically, the "onclick" event-handler for the ADD button on the form in which you select the seminar to add.

Hope that helps,

-Mykiel
 
Thanks for the download. I got it. I guess the problem that I have was my user id was not an number instead it was the user's lan id and with your example, I change all the user id to number. Thanks so much. Appreciate everyone's help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top