Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

Selection on MergeAll

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Situmorang - 02 Apr 2008 07:40 GMT
Hello,

This is my VBA to merge to all " chruch officers " for the year 2008.

Our database could be exists of many years. How can we use the benefit of
merge all but for selected year:

Thi is my VBA:
Private Sub cmdMergeAll_Click()
 
  Me.Refresh
  MergeAllWord ("select * from PelayanJemaat Where TahunPel=2008")
     'Note that you could use a condtion in the above sql
End Sub

Thanks in advance
Signature

H. Frank Situmorang

Albert D. Kallal - 02 Apr 2008 08:24 GMT
The first thing we'll need to know is the name of some date field, or how
you actually know that a member is for this year and active?

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

Frank Situmorang - 02 Apr 2008 10:46 GMT
Yes Albert, this command mergeall is on the form to fill in the church
officer and there is the field for year, but not the date. this is the number.

May be that is the problem why my VBA does not work??: This is my modified
VBA after informed by someone in this forum:
Private Sub cmdMergeAll_Click()
Dim lngMergeYear As Long

   If IsNull(Me.txtMergerYear) Then
       MsgBox "Perlu disi tahun"
       Exit Sub
   Else
       lngMergeYear = Clng(Me.txtMergeYear)
   End If
  Me.Refresh
  MergeAllWord ("select * from PelayanJemaat Where TahunPel= " &
lngMergeYear”)
     'Note that you could use a condtion in the above sql
End Sub
I appreciate your help
Signature

H. Frank Situmorang

> The first thing we'll need to know is the name of some date field, or how
> you actually know that a member is for this year and active?
Albert D. Kallal - 02 Apr 2008 11:01 GMT
MergeAllWord ("select * from PelayanJemaat Where TahunPel= " &
lngMergeYear")

The above has a extra "quote" at the end....does the above even compile??

Remote the last trailing quote you have right after LngMergeYear"  <--  
remote quote.

eg:

  MergeAllWord  "select * from PelayanJemaat Where TahunPel= " &
lngMergeYear"

Note that if TahunPel a text type field, then you need the following with
quotes (check in the table design mode if TahanPel is number or text).

If it is a text field, then you need to surround the sql with quotes...

eg:

  MergeAllWord "select * from PelayanJemaat
Where TahunPel= '" & lngMergeYear & "'"

Watch for word wrapping in the above...they should be on one line....

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

Frank Situmorang - 02 Apr 2008 11:19 GMT
I have checked it Albert, the field is a number type, not a text.

So what should I do , There should be no double  quote?
Signature

H. Frank Situmorang

>    MergeAllWord ("select * from PelayanJemaat Where TahunPel= " &
> lngMergeYear")
[quoted text clipped - 20 lines]
>
> Watch for word wrapping in the above...they should be on one line....
Frank Situmorang - 02 Apr 2008 12:04 GMT
Thanks very much Albert it works perfectly now. Your help is greatful.

Signature

H. Frank Situmorang

>    MergeAllWord ("select * from PelayanJemaat Where TahunPel= " &
> lngMergeYear")
[quoted text clipped - 20 lines]
>
> Watch for word wrapping in the above...they should be on one line....
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.