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!

Save To A Table

Status
Not open for further replies.

Icecream7

Programmer
Apr 19, 2006
35
US
I'm working on a form that I need to get the information from a sub form saved to a table when the save button is clicked. I've tried several different things that I have found and none of it seems to work. When I was messing around I created a Public Sub Information() and it inserted the following at save_click ( I added in the table information).

Dim Information As TableDefs

TableName = "Complete Table"
PrimaryKey = "Quote Number"
CustomerName = "Customer Name"
StretAddress = "Street Address"

How do I get this information saved to the table? I'm up for any suggestions at this point because I can't seem to get it to work.
 
the wizard gives you this..
(bound to a table)

Private Sub SaveRecCMD_Click()
On Error GoTo Err_SaveRecCMD_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "record saved", vbInformation, "nameOfDatabase"
DoCmd.GoToRecord , , acNewRec

Exit_SaveRecCMD_Click:
Exit Sub

Err_SaveRecCMD_Click:
MsgBox Err.Description
Resume Exit_SaveRecCMD_Click

End Sub



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.
 
The sub form is created from a table but I need it to save to a different table. What the big picture of it is.....
I also have several list boxes on the form which contain several options that they can select more than one thing. What I want to happen is for the customer information (cust number, name, address etc) to save to the table and the options from the listboxes to also save to it under that customer. If I can get it right I want to turn around and pull that information into an invoice for printing.


So true......
"Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client."
 
Hi

Two possible courses of action

1) can you make an updateable query joining the two tables and base your sub form on that?, if yes you couuld use a bound form to update the two tables via the query without needing any code

2) if 1 is not possible, look at docmd.runsql in help, and also look at the syntax of the INSERT INTO query type also in help

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi KenReay

I'll give them both a try. Only thing I'm wondering is if I have the sub form already created will it get messed up with changing it? I am supposed to have this project done in a few weeks so I'm trying to find the fastest easiest way possible.

Do you know anything about connecting to the database? It will have about 3 people accessing it and it will be accessed off location so I am wondering the best way to host it. I have an ftp site I thought about saving it to. I posted a couple of times asking but so far there hasn't been any response.
 
Hi

"Only thing I'm wondering is if I have the sub form already created will it get messed up with changing it? I am supposed to have this project done in a few weeks so I'm trying to find the fastest easiest way possible."

you will take a back up copy BEFORE changing anything won't you?

"Do you know anything about connecting to the database? It will have about 3 people accessing it and it will be accessed off location so I am wondering the best way to host it. I have an ftp site I thought about saving it to. I posted a couple of times asking but so far there hasn't been any response."

If you are using jet (ie native Access) databse to hold tables, you may have a problem, jet is not client server. If you have only three weeks to go, I would advise some experimenting on how you might achieve workaqble connection, or a switch to a client server backed for your tables (eg SQL Server, or MYSQL, etc etc)

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi Ken

Yes I have several back ups of the database. I create one before I do any major changing incase I need to go back to an earlier form of it. This is the first time I've worked with code in Access, I've done the basic creating a table,query etc but never the code behind it. As for the sql server....no I haven't worked with it either. The business does have a server on site that I can put this on and I think they have it set up for remote access. I'm basically learning as I'm going.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top