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

Record Set

Status
Not open for further replies.

Icecream7

Programmer
Apr 19, 2006
35
US
This may be a stupid question but I need to ask it......Can you have 2 recordsets in one event. With my form I want some of the information to write to one table and the rest to the other. I got the suggestion of splitting my table into two which I like, I'm just trying to figure it out before I change to much.

Also how would I get the form to write one person's options to a new row on the table? I'm still working on getting the CustomerID (an auto number) to transfer to the table with the persons name (chosen from a listbox).
 
'the folowing sql adds the new data to the end of the tbltable
'strSQL = "INSERT INTO tblTable ( ANumber, AString, ADate ) Values ( Me.ANumber, ' Me.AString ', # Me.ADate & # )"
docmd.runsql

first brackets contain the fields. second brackets contain the values

using recordsets, its a case of

.addnew
!field1 = me.textbox1
!field2 = me.textbox2
.update


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
So then I will need to declare the sql in the save button's click event? Also, if my user chooses multiple items from the listbox how would I write it to begin a new row for each selection?

Thanks for the help
 
How are ya Icecream7 . . .

I'm curious as to why your relying on recordsets in code when it appears its not necessary. Reason being, in your post origination you say:
Icecream7 said:
[blue]With my form I want some of the information to write to one table and the rest to the other. [purple]I got the suggestion of splitting my table into two which I like[/purple], I'm just trying to figure it out before I change to much.[/blue]
Since you intend to split the table, I'm sure [blue]some relationship will be established[/blue] between the two. With that a [blue]Form with subForm would allow you to directly save to both tables[/blue] (no code necessary)!

[blue]Your thoughts?[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi TheAceMan1, thanks for the advice on the subform. This whole project is begining to make me very frustrated. The realationships is what I seem to be having a problem with. I did create a subform on the main but it needs tweeking. My customers form is saving to a table but the subform isn't so I need to find what is happening. I've been working on this project for so long I have family members saying "your still doing that".....makes me wanna slap them :)

So if my listboxes are created from a query how would I be able to have those options write to the other table? Sorry if it's a stupid question, I'm just confusing myself by making it harder than it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top