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

Having trouble making it work 1

Status
Not open for further replies.

Jimenda

IS-IT--Management
Jun 13, 2001
19
0
0
US
I have a form that has 7 combo boxes, I would like to be able to make a selection in each box (if no selection made, then default or null), and then click on a button and have the selected items in each combo box to update/add 7 separate fields on a new line of a separate table. If anyone can help I would appreciate it. I already have the combos setup and can select a value in each combo. I am just not sure how to have a button cause all of the info
to update a table.
--
Thank You & God Bless,

Jimenda
 
Have the button click event create a SQL INSERT INTO string based on the combo data.

John Borges
 
How are ya Jimenda . . . . .

Are all combobox data text/numeric?

If mixed datatype list combobox names & types . . .

Calvin.gif
See Ya! . . . . . .
 
How about just making the RecordSource of your form be the table that you want to add to? Then make the Control Source of each combo box be the field you want updated?

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This seems to be a relatively simpler form. For forms like this, I find that using the form wizard (though I am not a big fan of it) can make things much easier. You can set your actual fields on the tables themself to be a combo or list box. By doing this, the form wizard will make it that way automatically when you create it, and then the data entered will go into those tables when you hit the next record or save record function. Sometimes using a more dumbed-down method of things can be the best solution whether you are a pro or not. However you decided to do it, I hope everything works out!

-Eric
 
Thanks, I did go back and use the wizard and I got the table to update. But it updates the table on the same line each time. How can I get it to generate a new record each time and to save after each update?

Thank You and God Bless,

JIMENDA
 
Does your form have a recordsource? If so, just move to a NEW RECORD (the navigation button with the * on it).

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Let's start over....When you are typing into a bound form (a form which has a Record Source), the data is going directly into a table. You don't have to hit SAVE RECORD to make it go into the table. The form...it is navigating through your records one by one. View the navigation buttons at the bottom of the screen, and make your ID field visible. You can click thru them each one at a time and see them all. When you get to a 'blank' record, you can then add new data and it's a new record. Again, the data writes directly to your table without you having to do a thing.

Hope this helps--g

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks g
Sorry about the Dups, new at this. In my table that I am updating thru my form, it just seems to keep re-writing the same record and incrementing the ID #. It is on #6 now (after 6 test inputs) but only 2 records show on my table and the navigation bar only shows 2, the re-written one and the new line which never gets added. here is the code I am using, I am not sure I have a recordset or not. Can you Help?

_______________________________________________________
Private Sub ENTER_Click()
On Error GoTo Err_ENTER_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_ENTER_Click:
Exit Sub

Err_ENTER_Click:
MsgBox Err.Description
Resume Exit_ENTER_Click

End Sub
__________________________________________________________


Thank You and God Bless,

JIMENDA
 
Hi. To see what your recordsource is, open your form in Design View. Look at the Recordsource property.

when you start a new record, are you typing over what is already there, or are you typing into blank fields?

Have you tried what I suggested?

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I don't know if you can tell by my code but my table does not update until I click on the submit button (Enter Sub) & then it always write over what was on the top line with what is in my 7 combos. What I need it to do is to create a new line(record) and then input combos data, any suggestions?

Thank You and God Bless,

JIMENDA
 
Hi. I totally understand what you are asking and am trying over and over to help diagnose what the problem is. Can you please answer my questions above?

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
g,
Thank you for your help and patience. I did finally get the event sub to what I wanted, I added a line:

DoCmd.GoToRecord , , acNewRec

just before my other actions, this seemed to straighten things out. Once again thank you.

Jimenda
 
Hi there--glad it works for you, but it's really totally unnecessary. As you enter data into a record, it's going into the table. No need for a SAVE RECORD at all, it's already there. The data will be saved even if you do not hit that button. And as I said before, if you just navigate to the next (new) record using the navigation buttons, that'll work too. Maybe the issue is because you have all combo boxes, you are not tabbing thru form controls like a usual form has. Usually, a user enters data in text boxes and combo boxes, and uses the TAB key to move to the next control. After the last control on the form, if you hit ENTER or TAB key, since there are no more controls, it advances to the next record. Maybe since you are just picking from combo boxes and not using the TAB key as a normal course of action, that isn't happening for you. Which is as expected, just not what you want.

Check the TAB ORDER on your form, and make sure the combo boxes are in the right tab order. then another way you can advance to the next record is using the TAB key.

Glad it worked out for you.

g

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top