If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Here's the code:
Private Sub SAVE_BUTTON_Click() On Error GoTo Err_SAVE_BUTTON_Click Dim MyDb As Database, Myrec As Recordset Set MyDb = CodeDb() ' Current MDB Set Myrec = MyDb.OpenRecordset("Select * From Office Where Office_ID = " & Me.Office_Code) If Myrec.EOF Then ' No records Myrec.AddNew Else Myrec.Edit ' record exist End If Myrec!Office_Name = Me.Office_Name Myrec!Business_City = Me.Business_City Myrec!Business_ST_Add = Me.Business_address Myrec!Business_ZIP = Me.Business_ZIP Myrec!Mailing_City = Me.Mailing_City Myrec!Business_ZIP = Me.Business_ZIP Myrec!Mailing_ST_Add = Me.Mailing_Address Myrec.Update Exit_SAVE_BUTTON_Click: Exit Sub Err_SAVE_BUTTON_Click: MsgBox Err.Description Resume Exit_SAVE_BUTTON_Click End Sub |
#12
|
|||
|
|||
Upon a little further investigation, when I tried to change the Myrec.Edit
statment, after I type "Myrec." a drop down menu is displayed with a list of statement values/functions, and oddly enough, the "Edit" statement is not present, but "Save" and "Update" are. I tried using both of those in the place of "Edit" and it complies fine, but when I click the "SAVE" button, I get the error "Too few Parameters. Expected 1." Don't know if this would help or not. |
#13
|
|||
|
|||
Sorry for the delay
I have never seen this, that the edit doesn't apear on the list, so try removing the edit line, It could be that its by default set to edit, unless you tell it other wise. Cange that : If Myrec.EOF Then ' No records Myrec.AddNew Else Myrec.Edit ' record exist End If To: If Myrec.EOF Then ' No records Myrec.AddNew End If "DrewTheFather" wrote: Upon a little further investigation, when I tried to change the Myrec.Edit statment, after I type "Myrec." a drop down menu is displayed with a list of statement values/functions, and oddly enough, the "Edit" statement is not present, but "Save" and "Update" are. I tried using both of those in the place of "Edit" and it complies fine, but when I click the "SAVE" button, I get the error "Too few Parameters. Expected 1." Don't know if this would help or not. |
#14
|
|||
|
|||
Found the problem, in the reference locate the dao3.6 strait after the Access
11 reference. If you have an ole automation refernce, the dao should be before it. DrewTheFather wrote: Here's the code: Private Sub SAVE_BUTTON_Click() On Error GoTo Err_SAVE_BUTTON_Click Dim MyDb As Database, Myrec As Recordset Set MyDb = CodeDb() ' Current MDB Set Myrec = MyDb.OpenRecordset("Select * From Office Where Office_ID = " & Me.Office_Code) If Myrec.EOF Then ' No records Myrec.AddNew Else Myrec.Edit ' record exist End If Myrec!Office_Name = Me.Office_Name Myrec!Business_City = Me.Business_City Myrec!Business_ST_Add = Me.Business_address Myrec!Business_ZIP = Me.Business_ZIP Myrec!Mailing_City = Me.Mailing_City Myrec!Business_ZIP = Me.Business_ZIP Myrec!Mailing_ST_Add = Me.Mailing_Address Myrec.Update Exit_SAVE_BUTTON_Click: Exit Sub Err_SAVE_BUTTON_Click: MsgBox Err.Description Resume Exit_SAVE_BUTTON_Click End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
#15
|
|||
|
|||
In my References option, there is no record of an Access 11 reference....I
tried browsing, but could not find it. Is this causing the problem? "Ofer C via AccessMonster.com" wrote: Found the problem, in the reference locate the dao3.6 strait after the Access 11 reference. If you have an ole automation refernce, the dao should be before it. |
#16
|
|||
|
|||
You need reference to MSACC.OLB you might have a different Access, 8 or
something If so put the other reference, dao3.6, just after it "DrewTheFather" wrote: In my References option, there is no record of an Access 11 reference....I tried browsing, but could not find it. Is this causing the problem? "Ofer C via AccessMonster.com" wrote: Found the problem, in the reference locate the dao3.6 strait after the Access 11 reference. If you have an ole automation refernce, the dao should be before it. |
#17
|
|||
|
|||
I have a reference to MSACC9.OLB directly followed by a reference to the DAO
3.6 From what I have looked at and tested, correct me if I'm wrong, but the problem lies in the SET of Myrec. This is error starting to wear on me. "Ofer" wrote: You need reference to MSACC.OLB you might have a different Access, 8 or something If so put the other reference, dao3.6, just after it "DrewTheFather" wrote: In my References option, there is no record of an Access 11 reference....I tried browsing, but could not find it. Is this causing the problem? "Ofer C via AccessMonster.com" wrote: Found the problem, in the reference locate the dao3.6 strait after the Access 11 reference. If you have an ole automation refernce, the dao should be before it. |
#18
|
|||
|
|||
|
#19
|
|||
|
|||
I tried sending the file to you from two different addresses and it failed
due to the size of the Zip'ed file. Any other suggestions? |
#20
|
|||
|
|||
OK, so now I got the Save (update) working, now I'll be working on adding a
new record. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create Report by using the current record in a form | ember | General Discussion | 4 | September 15th, 2005 02:48 PM |
User Saving a Record else it deletes | Carter Wexler | Using Forms | 1 | August 2nd, 2005 11:57 PM |
Design help, please | SillySally | Using Forms | 27 | March 6th, 2005 04:11 AM |
Prevent Blank Records being written. Need Help. | Robert Nusz @ DPS | Using Forms | 4 | December 29th, 2004 05:15 PM |
Open form, Edit button, etc | Aniko | Using Forms | 14 | July 25th, 2004 08:17 AM |