Share a database? Am I on the right page?

Rtm?

While the forums are great for help, there are some of your questions that are easily answered by searching through the Access help files. The reading isn't all that intensive, and you seem like a smart enough cookie to catch on. I would recommend diving into the VBA help (using code in forms and such) headfirst. I only say this because it REALLY helped me back into the VBA swing. (I think Pat suggested it to me way back in March/April ^_^).

For instance, about the question of auto-closing the update form after a messagebox: in design view, right-click any item and click the "properties" selection. This will bring up the properties dialog. Using the object selection dropdown, find an object like a textbox or the form itself - essentially anything that looks manipulable by the user - and select the "Events" tab. Here, you'll find the various actions attributed to this form element (ie: beforeUpdate, onClick, etc). If you want a confirmation for the update first, follow this process:

· select your command button, open the properties dialog.
· select the "other" tab, and name the button according to conventions (cmd<WhatItDoes>).
· select the event tab, find "onClick" (when you focus on this element, a small button with an ellipsis will appear to the right - you can use this or the drop down to select "[Event Procedure]" - which you will use to open the code window.
· look up in Access Help how to use Y/N message boxes as a starting point for data operations - they're great for deciding simple cases (if yes, do this; if no, don't do this).

Then (provided you want the form to close regardless of what they click), in the end of each selection's code you'll put a line with a command ("DoCmd." element) that tells that particular form to close itself.

Once you start learning the VBA code this way, you'll be able to intuitively answer a lot of these questions on your own. I started doing that, and it's really helped me a great deal - Pat will tell you, I was really at a loss there in March/April. ^_^

Just my two bits on how to be successful with Access. The forums are great, but there are a LOT of duplicate questions floating around. You're not dumb, for the record - my boss is dumb. At least you understand the value of Access and the value of well placed questions. ^_^

The other thing that really helped me was the deprecated Object Model for Access. Hey, Pat - do you have a link to that somewhere? I can't find one, and the one I have isn't on my office machine.


Cheers!

- Z
 
Thanks.

Thank you all for your help. You know, I left computers to get into Avionics (electrical aircraft maintenance) Now that you all have given me just a little taste of programming, I can see how easy it would be if you were properly trained. Me like. :-) Me think me like to build! GRUNT! Now I regret not taking a few programming courses....but, I think I will over the next few years....will complement my support and avionics experience.

So what's the best to get training for these days? VB?

This is the final that I ended up with after playing around.

Private Sub Command0_Click()
On Error GoTo tagError
response = MsgBox("Do you want to Update?", vbYesNo + vbQuestion, "Continue?")
If response = vbYes Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryExcelappend", acViewNormal
DoCmd.Close acQuery, "qryExcelappend", acSaveYes
DoCmd.OpenQuery "qryExcelupdate", acViewNormal
DoCmd.Close acQuery, "qryExcelupdate", acSaveYes
DoCmd.OpenQuery "deletecities1", acViewNormal
DoCmd.Close acQuery, "deletecities1", acSaveYes
DoCmd.OpenQuery "deletecities2", acViewNormal
DoCmd.Close acQuery, "deletecities2", acSaveYes
DoCmd.SetWarnings True
Else
DoCmd.Close acForm, "Update / Append from Excel", acSaveYes
End If
Exit Sub
tagError:
MsgBox Err.Description
Exit Sub
Resume
End Sub

kousotsu said:
While the forums are great for help, there are some of your questions that are easily answered by searching through the Access help files. The reading isn't all that intensive, and you seem like a smart enough cookie to catch on. I would recommend diving into the VBA help (using code in forms and such) headfirst. I only say this because it REALLY helped me back into the VBA swing. (I think Pat suggested it to me way back in March/April ^_^).

For instance, about the question of auto-closing the update form after a messagebox: in design view, right-click any item and click the "properties" selection. This will bring up the properties dialog. Using the object selection dropdown, find an object like a textbox or the form itself - essentially anything that looks manipulable by the user - and select the "Events" tab. Here, you'll find the various actions attributed to this form element (ie: beforeUpdate, onClick, etc). If you want a confirmation for the update first, follow this process:

· select your command button, open the properties dialog.
· select the "other" tab, and name the button according to conventions (cmd<WhatItDoes>).
· select the event tab, find "onClick" (when you focus on this element, a small button with an ellipsis will appear to the right - you can use this or the drop down to select "[Event Procedure]" - which you will use to open the code window.
· look up in Access Help how to use Y/N message boxes as a starting point for data operations - they're great for deciding simple cases (if yes, do this; if no, don't do this).

Then (provided you want the form to close regardless of what they click), in the end of each selection's code you'll put a line with a command ("DoCmd." element) that tells that particular form to close itself.

Once you start learning the VBA code this way, you'll be able to intuitively answer a lot of these questions on your own. I started doing that, and it's really helped me a great deal - Pat will tell you, I was really at a loss there in March/April. ^_^

Just my two bits on how to be successful with Access. The forums are great, but there are a LOT of duplicate questions floating around. You're not dumb, for the record - my boss is dumb. At least you understand the value of Access and the value of well placed questions. ^_^

The other thing that really helped me was the deprecated Object Model for Access. Hey, Pat - do you have a link to that somewhere? I can't find one, and the one I have isn't on my office machine.


Cheers!

- Z
 
Error saving record updates

I am getting the same error that started this thread.

can't save design changes or save to anew database object because another user has the file open. To save your design changes or to save a new object, you must have exclusive access to the file.

I will try splitting the database to see if that resolves the problem, but what I don't understand is that I am not changing the design of the form. I am only trying to add a new record to an existing table using an existing form. Does anybody know what is making access think that I have a new object or a design change?

Any input appreciated. Thanks in advance, Tammy.
 
If you copied the code that ReAn posted such as:

DoCmd.OpenQuery "qryExcelappend", acViewNormal
DoCmd.Close acQuery, "qryExcelappend", acSaveYes
DoCmd.OpenQuery "qryExcelupdate", acViewNormal
DoCmd.Close acQuery, "qryExcelupdate", acSaveYes

Those close commands are saving the querydef which can cause problems in a shared database. Since the querydef was not changed, it is not necessary to save them. Also, action queries do not open a recordset for viewing, they simply run. So, append, update, and delete queries don't leave open recordsets making the Close command completely redundant.

Make sure that code that saves is actually saving the record rather than the object. Code to save the record looks like:
DoCmd.RunCommand acCmdSaveRecord
Anything else is likely saving an object.
 
Doesnt sharing work?

I shared my dbase on one pc , giving it full control over the LAN; however, when accessed on another PC, it gives a run time error and all forms appear without any labels and text boxes.

Can you explain why and provide a better alternative with minimum coding (as I have worked on dbase for a loooooong time and dont wish to work over the coding again)

Thanks again!!
 

Users who are viewing this thread

Back
Top Bottom