Jumat, 04 November 2011

RE: [AccessDevelopers] Re: Access 2010 Lending Library application

 

I'm looking at your code and I see 3 GoToRecord's.  The first is to go to a new record which if it worked before should still work.  The 2nd and 3rd are no longer necessary because we gave you an alternative way to save the record other than going to the next record and back to the last record to in effect trigger a save.  You can replace these 2 GoToRecord statements with either
    Me.Dirty = False
  or
    DoCmd.RunCommand acCmdSaveRecord
 
Where did you put one of these statements?  Posting the code again would help us help you.
 
But looking further at what you are trying to do with your code, I don't quite understand.  You have a checkout button that when clicked, goes to a new record, sets the CustomerID and InventoryItemID to whatever is in the corresponding text boxes (which I assume are unbound text boxes or they would clear when you went to a new record), and then saves the record (is that all that is stored in the record, just Customer and InventoryItem ID and nothing else??), clears the value in the (unbound?) txtInventoryItemID text box, hides an InventoryItemLookup combo or list box, and then makes the Check Out button itself not visibile.
 
Why not just have bound controls, where the customer picks the item to checkout, clicks Check Out button, and Go To new record ready to checkout another?  Why all the apparently unbound controls for data to be entered, then programmatically copy them over to the bound controls after clicking a button, and creating the entire record programmatically instead of filling out the current record and saving when done?  It looks like when the Check Out button is clicked, there is no current record at all yet, just some unbound controls filled out.
 
Some food for thought.
 
Hope that helps,
Toby
 
-----Original Message-----
From: AccessDevelopers@yahoogroups.com [mailto:AccessDevelopers@yahoogroups.com] On Behalf Of leebasmith
Sent: Monday, October 24, 2011 1:23 AM
To: AccessDevelopers@yahoogroups.com
Subject: [AccessDevelopers] Re: Access 2010 Lending Library application

 

I tried that but it now says it can't get to specified record witht eh error on the first GoToRecord

Thank you for your help.

--- In AccessDevelopers@yahoogroups.com, "Liveson Tumbulu" <l.tumbulu@...> wrote:
>
> If the purpose of the routine is to save the record then you may consider
> this popular code:
>
>
>
> If Me.Dirty Then
>
> Me.Dirty = False
>
> End If
>
>
>
> Hope that helps
>
>
>
> Liveson
>
>
>
> From: AccessDevelopers@yahoogroups.com
> [mailto:AccessDevelopers@yahoogroups.com] On Behalf Of leebasmith
> Sent: Monday, 24 October, 2011 9:44 AM
> To: AccessDevelopers@yahoogroups.com
> Subject: [AccessDevelopers] Access 2010 Lending Library application
>
>
>
>
>
> I am building the library Application from "Pro Access 2010 Development"
> book.
>
> I have a checkOUt form that has a checkout button that if availble will lend
> out the book. For some reason it is not working. Here is the code:
>
> Private Sub CheckOut_Click()
> 'Go to a new record
> DoCmd.GoToRecord acDataForm, "CheckOut", acNewRec
> CustomerID = txtCustomerID
> InventoryItemID = txtInventoryItemID
>
> 'Cause the focus to move off the current record, which
> 'will cause it to be saved
> DoCmd.GoToRecord acDataForm, "CheckOut", acNext // Here is where it gets
> stuck
> DoCmd.GoToRecord acDataForm, "CheckOut", acLast
>
> 'Reset the form controls
> txtInventoryItemID = ""
> DoCmd.Requery "InventoryItemLookup"
> InventoryItemLookup.Visible = False
> CheckOut.Visible = False
> End Sub
>
> Can anyone Help.
> Thanks
> Leeba
>

__._,_.___
Recent Activity:

Please zip all files prior to uploading to Files section.
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