Rabu, 28 September 2011

RE: [MS_AccessPros] Attachment control

 

Steve-

The DONE command should be:

Private Sub cmdDone_Click()

' Trap any save error
On Error Resume Next
' Save the record
RunCommand acCmdSaveRecord
' See if cancel error occurred and if so bail
If Err <> 0 Then Exit Sub
' Close the form
DoCmd.Close acForm, Me.Name

End Sub

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Steve
Sent: Wednesday, September 28, 2011 4:01 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Attachment control

John,

I should have stated my question more clearly, my apologies for the fog!

The DONE command button event procedure has one line of code. It works
OK, closing the form without the error message: DoCmd.Close acForm,
"tbl_items", acSaveNo

The error message is generated when the user right clicks the form tab
at the top of the screen and selects Close from the pop up menu. I'd
prefer they use the DONE command button, but they don't always. So I
either must hide the tab (if that's even possible, I for one don't know
how) or circumvent the error message.

Steve

On 9/28/2011 2:19 AM, John Viescas wrote:
> Steve-
>
> Is the user closing the form, or are you doing it in code? It's closing the
> form with the dirty record still on it that's causing the error. What code do
> you have behind the DONE button?
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Steve
> Sent: Tuesday, September 27, 2011 11:40 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: Re: [MS_AccessPros] Attachment control
>
> John -
>
> That works, but I get a "You can't save the record at this time" error
> message asking the user "Do you want to close the database object anyway?"
>
> How can I suppress the error message and return the user to the screen
> so he can make corrections?
>
> Steve
>
> On 9/27/2011 4:15 PM, John Viescas wrote:
>> Steve-
>>
>> Set Cancel = True to stop the save.
>>
>> John Viescas, author
>> Microsoft Office Access 2010 Inside Out
>> Microsoft Office Access 2007 Inside Out
>> Building Microsoft Access Applications
>> Microsoft Office Access 2003 Inside Out
>> SQL Queries for Mere Mortals
>> http://www.viescas.com/
>> (Paris, France)
>>
>>
>>
>> -----Original Message-----
>> From: MS_Access_Professionals@yahoogroups.com
>> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Steve
>> Sent: Tuesday, September 27, 2011 10:06 PM
>> To: MS_Access_Professionals@yahoogroups.com
>> Subject: Re: [MS_AccessPros] Attachment control
>>
>> John,
>>
>> If during the BeforeUpdate event I do field validation and find
>> something wrong, how do I stop the record from being added to the table
>> and keep the form on the screen for the user to make corrections?
>>
>> Steve
>>
>> On 9/27/2011 10:33 AM, John Viescas wrote:
>>> Steve-
>>>
>>> Why not just open a bound form in Data Entry mode? You can still validate
>> stuff
>>> in the BeforeUpdate event of the form. Let Access do all the work.
>>>
>>> John Viescas, author
>>> Microsoft Office Access 2010 Inside Out
>>> Microsoft Office Access 2007 Inside Out
>>> Building Microsoft Access Applications
>>> Microsoft Office Access 2003 Inside Out
>>> SQL Queries for Mere Mortals
>>> http://www.viescas.com/
>>> (Paris, France)
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: MS_Access_Professionals@yahoogroups.com
>>> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Steve
>>> Sent: Tuesday, September 27, 2011 3:51 PM
>>> To: MS_Access_Professionals@yahoogroups.com
>>> Subject: Re: [MS_AccessPros] Attachment control
>>>
>>> Hi John,
>>>
>>> Why unbound? Well, it seemed a good way to gather the information needed
>>> for a new table record. When the user clicks the DONE command button, I
>>> do some error checking in the command button click event procedure and
>>> then an SQL INSERT INTO is used to add a new table record. Maybe that is
>>> not the best or even a good way to add a record to a table?
>>>
>>> Unbound or not, shouldn't double-clicking the attachment control bring
>>> up the Attachments panel?
>>>
>>> The attachments will typically be one or two files, most often pdf's or
>>> pictures.
>>>
>>> Thank you.
>>>
>>> Steve
>>>
>>> On 9/27/2011 8:42 AM, John Viescas wrote:
>>>> Steve-
>>>>
>>>> Why unbound?
>>>>
>>>> An attachment control is useless unless bound. What sort of attachment,
and
>>> how
>>>> many? You could provide a command button to open a File dialog to locate
> the
>>>> file or files that should end up as attachments. Then to add the
>> attachments,
>>>> you'll need to first create the record with all the non-attachment data,
> save
>>>> it, then open up the Recordset2 object of the attachment field to load the
>>>> files. I can dig up some sample code if you need it.
>>>>
>>>> John Viescas, author
>>>> Microsoft Office Access 2010 Inside Out
>>>> Microsoft Office Access 2007 Inside Out
>>>> Building Microsoft Access Applications
>>>> Microsoft Office Access 2003 Inside Out
>>>> SQL Queries for Mere Mortals
>>>> http://www.viescas.com/
>>>> (Paris, France)
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: MS_Access_Professionals@yahoogroups.com
>>>> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Steve
>>>> Sent: Tuesday, September 27, 2011 2:29 PM
>>>> To: MS_Access_Professionals@yahoogroups.com
>>>> Subject: [MS_AccessPros] Attachment control
>>>>
>>>> I have a table with about a dozen fields, one of which is the attachment
>>>> data type.
>>>>
>>>> I am developing a form with unbound controls which the user will
>>>> populate with information, click the DONE command button and add a new
>>>> record to the table.
>>>>
>>>> The form is working OK except for the attachment control. Double
>>>> clicking does not bring up the Attachments panel. Right clicking the
>>>> control brings up the context menu, but the Manage Attachments selection
>>>> is grayed out.
>>>>
>>>> What do I need to do to get the Attachment control to work?
>>>>
>>>> Thanks.
>>>>
>>>> Steve
>>>>
>>>>
>>>> ------------------------------------
>>>>
>>>> Yahoo! Groups Links
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------
>>>>
>>>> Yahoo! Groups Links
>>>>
>>>>
>>>>
>>>>
>>> ------------------------------------
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar