Rabu, 26 Oktober 2011

Re: [MS_AccessPros] My first Do Loop but with questions

 

You're welcome, Jim.

Bill

--- In MS_Access_Professionals@yahoogroups.com, Jim Wagner <luvmymelody@...> wrote:
>
> Bill,
>
> Thanks, that was it. I was trying to run it without the button.
>
>  
> Jim Wagner
> ________________________________
>
>
>
> ________________________________
> From: Bill Mosca <wrmosca@...>
> To: MS_Access_Professionals@yahoogroups.com
> Sent: Tuesday, October 25, 2011 12:57 PM
> Subject: Re: [MS_AccessPros] My first Do Loop but with questions
>
>
>  
> Jim
>
> When stepping through an event you have to first fire the event from the form or report.
>
> Put a break point on the *Private Sub* line. Then open the form in form view and click the button. That should brign you to the code window at the break point with the code line highlighted in yellow.
>
> From there you can step through the code.
>
> The same holds true for functions that take a parameter. To run those you need to put a break point on the first line of code & open the Immediate (debug) window and type:
> ?MyFunction MyParameter
>
> Then press Enter and the function will break at the BP so you can step through it. Otherwise, all you'll get is a macro window asking you what you want to run.
>
> Regards,
> Bill Mosca, Founder - MS_Access_Professionals
> http://www.thatlldoit.com
> Microsoft Office Access MVP
> https://mvp.support.microsoft.com/profile/Bill.Mosca
>
> --- In MS_Access_Professionals@yahoogroups.com, Jim Wagner <luvmymelody@> wrote:
> >
> > Crystal,
> >
> > Your code worked like a charm.
> > But I have a follow up question. I noticed that even after compiling I cannot use F8 to step into the code. I just hear a beep. Do I have something wrong?
> >
> >  
> > Jim Wagner
> > ________________________________
> >
> >
> >
> > ________________________________
> > From: Crystal <strive4peace2008@>
> > To: "MS_Access_Professionals@yahoogroups.com" <MS_Access_Professionals@yahoogroups.com>
> > Sent: Tuesday, October 25, 2011 10:21 AM
> > Subject: Re: [MS_AccessPros] My first Do Loop but with questions
> >
> >
> >  
> > hi Jim,
> >
> > > " I saw that hyphen and thought why would they use that."
> >
> > the Access template follows names created by the Outlook structure ... so no thought about good practice went into the names.  It makes transferring data easier between Access and Outlook when the names are the same since they don't have to be mapped.  Personally, I use good names and map if I need to exchange data.
> >
> > I, along with others, have talked to Microsoft about the poor naming in the templates -- they should set better examples, especially for Access.  If the templates accepted VBA code, you'd see some good examples but since they submissions are limited to macros, it is hard to make a worthy one.
> >
> > Warm Regards,
> > Crystal
> >
> >  *
> >    (: have an awesome day :)
> >  *
> >
> > ________________________________
> > From: Jim Wagner
> >
> > Crystal,
> >
> > I am using the template from MS that is for contacts. I saw that hyphen and thought why would they use that. I am using the database to conform to what I want to do. So I am learning new things in it. The do loop is way over due to learn.
> >
> > I will add your code and try it and then let you know. I am eventually going to add some code that emails a birthday card that is a report saved as a pdf to those in the table each day. I found some code that emails through gmail.
> >
> > Thank You
> >
> >  
> > Jim Wagner
> > ________________________________
> >
> > ________________________________
> > From: Crystal <strive4peace2008@>
> > To: "MS_Access_Professionals@yahoogroups.com" <MS_Access_Professionals@yahoogroups.com>
> > Sent: Tuesday, October 25, 2011 9:04 AM
> > Subject: Re: [MS_AccessPros] My first Do Loop but with questions
> >
> >  
> > Hi Jim, 
> >
> > you need to specify where to get [First Name] and [Last Name] as you did with myset![E-mail Address]
> >
> > to make things more efficient, I surrounded your corrected code with With...End With.  I also utilized + in case Last Name or E-mail Address is not filled out.  Also added cleanup code
> >
> > you should avoid using special characters and spaces in names.  Underscore _ is ok.
> >
> > '~~~~~~~~~~~~~~~~~~~~~
> > ' more statements
> >
> > With myset
> >    Do Until myset.EOF
> >
> >        MyAddress = nz(![E-mail Address],"")
> >        MsgBox "My name and address" & " " & MyAddress
> >
> >        MsgBox "My name and address is " _
> >           & ![First Name] & (" " + ![Last Name] ) & (" " + ![E-mail Address])
> >
> >       .MoveNext
> >    Loop
> > End With
> >
> > 'cleanup code
> > on error resume next
> > if not myset is nothing then
> >    myset.close
> >    set myset = nothing
> > end if
> > set db = nothing
> >
> > End Sub
> > '~~~~~~~~~~~~~~~~~~~~~
> >
> > instead of MsgBox, try using Debug.Print
> >
> > when you are running the code, you can look at the Immediate (debug) window instead of pressing OK all the time with a MsgBox
> >
> > press Ctrl-G to Goto the debuG window
> >
> > Warm Regards,
> > Crystal
> >
> >  *
> >    (: have an awesome day :)
> >  *
> >
> > ________________________________
> > From: luvmymelody
> >
> > Hello all,
> >
> > I am practicing my first do loop and questioning why it took me so long to learn this. But here I am with a question.
> >
> > I have the below code that I am trying to just get a message box to show first, last and address in the msgbox. If I use the first msgbox in the code it works great. The email addresses show up in the msgbox and all is great. But when I try to use the second msgbox in the code, I get the first name from the Contacts table and the email addresses from the tblTodaysBirthdays table cycle through with the same name. But the person's name in the msgbox is from the main table not the table the select statement is based on.
> >
> > I have several tables involved in the question. The contacts table and the tblTodaysBirthdays. The latter is a table made from a make table query built every day based on the Contacts table.
> >
> > Private Sub Command281_Click()
> > Dim mydb As DAO.Database
> > Dim myset As DAO.Recordset
> > Dim MyAddress As String
> >
> > Set mydb = CurrentDb
> > Set myset = mydb.OpenRecordset("SELECT * FROM tblTodaysBirthdays where [E-mail Address] is not null")
> >
> > Do Until myset.EOF
> >
> > MyAddress = myset![E-mail Address]
> > 'MsgBox "My name and address" & " " & MyAddress
> > MsgBox "My name and address is" & " " & [First Name] & " " & [Last Name] & " " & MyAddress
> > myset.MoveNext
> >
> > Loop
> > End Sub
> >
> > What am I missing here?
> >
> > Thanks for the help
> >
> > Jim Wagner
> >
> > [Non-text portions of this message have been removed]
> >
> > [Non-text portions of this message have been removed]
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
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