Sabtu, 31 Oktober 2015

Re: [MS_AccessPros] Subform didn't show

 

John-
I did put code in AfterUpdate event. It didn't show the subform, finally I put a command button to achieve. Thanks a lot.
Best Regards,
Kevin



在 "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>,2015年10月31日 下午6:36写道:

 

Kevin-


That code runs only when you move to a different row in your record source.  If you want to reveal the subform after you've entered something in GroupBookingID, then you need to use the AfterUpdate event of that control.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Oct 31, 2015, at 10:10 AM, 'zhaoliqingoffice@163.com' zhaoliqingoffice@163.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Dear All,
I use use "visible" to show and hide a subform, after input some data, the sub form still didn't show. Please help.

Private Sub Form_Current()
On Error GoTo ErrHandle

If IsNull(Me.GroupBookingID)  Then
Forms!frmGroupBooking!subPart.Visible = False

Else
Forms!frmGroupBooking!subPart.Visible = True
End If

ErrExit:
    Exit Sub
   
ErrHandle:
    Resume ErrExit
End Sub

Best Regards,
Kevin


Regards,
Kevin Zhao
 
Date: 2015-10-31 16:20
Subject: [MS_AccessPros] Subform didn't show
 

Dear All,
I use use "visible" to show and hide a subform, after input some data, the sub form still didn't show. Please help.

Private Sub Form_Current()
On Error GoTo ErrHandle

If IsNull(Me.GroupBookingID)  Then
Forms!frmGroupBooking!subPart.Visible = True

Else
Forms!frmGroupBooking!subPart.Visible = False
End If

ErrExit:
    Exit Sub
   
ErrHandle:
    Resume ErrExit
End Sub

Best Regards,
Kevin



__._,_.___

Posted by: zhaoliqingoffice <zhaoliqingoffice@163.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Re: [MS_AccessPros] Subform didn't show

 

Kevin-


That code runs only when you move to a different row in your record source.  If you want to reveal the subform after you've entered something in GroupBookingID, then you need to use the AfterUpdate event of that control.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Oct 31, 2015, at 10:10 AM, 'zhaoliqingoffice@163.com' zhaoliqingoffice@163.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Dear All,
I use use "visible" to show and hide a subform, after input some data, the sub form still didn't show. Please help.

Private Sub Form_Current()
On Error GoTo ErrHandle

If IsNull(Me.GroupBookingID)  Then
Forms!frmGroupBooking!subPart.Visible = False

Else
Forms!frmGroupBooking!subPart.Visible = True
End If

ErrExit:
    Exit Sub
   
ErrHandle:
    Resume ErrExit
End Sub

Best Regards,
Kevin


Regards,
Kevin Zhao
 
Date: 2015-10-31 16:20
Subject: [MS_AccessPros] Subform didn't show
 

Dear All,
I use use "visible" to show and hide a subform, after input some data, the sub form still didn't show. Please help.

Private Sub Form_Current()
On Error GoTo ErrHandle

If IsNull(Me.GroupBookingID)  Then
Forms!frmGroupBooking!subPart.Visible = True

Else
Forms!frmGroupBooking!subPart.Visible = False
End If

ErrExit:
    Exit Sub
   
ErrHandle:
    Resume ErrExit
End Sub

Best Regards,
Kevin



__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Re: [MS_AccessPros] Run an append query automatically

 

Kevin-


Your SQL is syntactically incorrect and should have generated an error.  You will not see the error if you included On Error Resume Next in your code.  You have commas in the wrong places and are missing blanks between keywords.  Here's my attempt to fix it:

strSQL = "INSERT INTO tblPartItineraryCityTourBookingRoom (RoomTypeID, NumberOfRooms) " & _
"SELECT tblGroupBookingRoom.RoomTypeID, tblGroupBookingRoom.NumberOfRooms " & _
"FROM tblGroupBookingRoom WHERE GroupBookingID= " & Me.Parent.GroupBookingID

I have no clue what this end snippet is trying to do:

" & "," & PartItineraryCityTourID

Are you trying to add a second comparison on the field PartItinerayrCityTourID??

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Oct 31, 2015, at 2:19 AM, zhaoliqingoffice zhaoliqingoffice@163.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Duane-
After runing the code, no error appears, and there's no record appended either.
Best Regards,
Kevin



在 "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>,2015年10月31日 上午9:02写道:

 

Two suggestions:
Don't state "it didn't work" without some statement of what your results were. Did you get an error? Were there no records added? Did record get added but they weren't as expected?
 
Add a debug.print to your code so you can easily see what SQL is being run. I rarely if ever Execute until I have used:
 
Debug.Print strSQL
' uncomment the next line once you have reviewed the strSQL
' CurrentDb.Execute strSQL, dbFailOnError
 
Duane Hookom, MVP
MS Access
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Sat, 31 Oct 2015 08:06:31 +0800
Subject: Re: [MS_AccessPros] Run an append query automatically



By the way, I did something like this, it didn't work out. What's wrong with my code? Thanks.

Dim strSQL As String

If IsNull(ELookup("PartItineraryCityTourBookingRoomID", "tblPartItineraryCityTourBookingRoom", "PartItineraryCityTourID=" & PartItineraryCityTourID)) Then

strSQL = "INSERT INTO tblPartItineraryCityTourBookingRoom (RoomTypeID, NumberOfRooms,)" & _
"SELECT tblGroupBookingRoom.RoomTypeID, tblGroupBookingRoom.NumberOfRooms" & _
"FROM tblGroupBookingRoom WHERE GroupBookingID=Me.Parent.GroupBookingID" & "," & PartItineraryCityTourID

CurrentDb.Execute strSQL, dbFailOnError

End If


Regards,
Kevin Zhao
 
Date: 2015-10-31 06:57
Subject: [MS_AccessPros] Run an append query automatically
 

Dear All,
Is that possible to click on a command button run an append query automatically without pop up windows. For example:

source table: tblBooking
BookingID Roomtype NumberOfRooms

Destination table: tblCityRoomBooking
CityRoomBookingID CityTourID RoomType NumberOfRooms

By cliecking on a command button on the frmCityTour, I want to append "RoomType, NumberOfRoom" into tblCityRoomBooking, and I hope the "CityTourID" will be filled according to "CityTourID" from frmCityTour. 

Can this be done? Thanks.
Best Regards,
Kevin


Regards,
Kevin Zhao





__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

.

__,_._,___

Re: [MS_AccessPros] Subform didn't show

 

Dear All,
I use use "visible" to show and hide a subform, after input some data, the sub form still didn't show. Please help.

Private Sub Form_Current()
On Error GoTo ErrHandle

If IsNull(Me.GroupBookingID)  Then
Forms!frmGroupBooking!subPart.Visible = False

Else
Forms!frmGroupBooking!subPart.Visible = True
End If

ErrExit:
    Exit Sub
   
ErrHandle:
    Resume ErrExit
End Sub

Best Regards,
Kevin


Regards,
Kevin Zhao
 
Date: 2015-10-31 16:20
Subject: [MS_AccessPros] Subform didn't show
 

Dear All,
I use use "visible" to show and hide a subform, after input some data, the sub form still didn't show. Please help.

Private Sub Form_Current()
On Error GoTo ErrHandle

If IsNull(Me.GroupBookingID)  Then
Forms!frmGroupBooking!subPart.Visible = True

Else
Forms!frmGroupBooking!subPart.Visible = False
End If

ErrExit:
    Exit Sub
   
ErrHandle:
    Resume ErrExit
End Sub

Best Regards,
Kevin

__._,_.___

Posted by: "zhaoliqingoffice@163.com" <zhaoliqingoffice@163.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Bls: Bls: [belajar-access] BELAJAR CLASS

 

oke bang aksan, sangat membantu, saya tunggu
terimakasih



Pada Jumat, 30 Oktober 2015 16:57, "Aksan Kurdin aksan.kurdin@gmail.com [belajar-access]" <belajar-access@yahoogroups.com> menulis:


 
dear satria,

di seminar microsoft sekian tahun lalu saya pernah buatkan sample form search .
nanti di rumah coba saya carikan kalau masih ada ya .. :)

aksan kurdin

On 10/29/2015 11:22 AM, satria kusuma satriauad@yahoo.co.id [belajar-access] wrote:
 
incredible bang aksan
saya masih awam tentang class....., berarti perhitungan di atas bisa dilakukan oleh module function dan class
  1. Nah,yang lebih efektif digunakan yang mana ya?
  2. Dalam bayangan saya, contoh class yaitu seperti memanggil form pencarian/searching. Dimana didalam form pencarian tersebut ada misalnya :
Private Sub Close()
    Form_txthasilcari.Nama = Me.Nama
End Sub
dimana textbox form induknya memanggil value dari form searching, masalahnya form induknya lebih dari satu form (waaah maaf nih jadi nglantur temanya...hehehe). Bang admin, lebih baik ganti tema atau gimana nih?
*:D tersenyum lebar*:) senang



Pada Senin, 19 Oktober 2015 9:31, "Aksan Kurdin aksan.kurdin@gmail.com [belajar-access]" <belajar-access@yahoogroups.com> menulis:


 
Pelajaran singkat mengenai class di access
Access menganut hybrid oop
kita bisa membuat class di access (VBA) tetapi tidak full oop, karena class ini tidak bisa dibuat pewarisan.

class itu adalah 'cetak biru' dari obyek yang akan dibuat.
contoh dalam hal ini adalah notaris.

'obyek'nya adalah notaris
dari penjabaran bang satria, diketahui, notaris punya 'property' pengikatan dan besar plafon.
obyek selain punya properti, juga punya 'metode' (apa yang bisa dikerjakan obyek tersebut).
dalam hal ini, metode yang dibutuhkan baru satu, yaitu menghitung biaya.

kita buat definisi class nya dengan memilih menu new Class Module, dan simpan sebagai nama class nya.
Biasanya sebagai standarisasi, nama class diawali dengan huruf C, dari nama obyeknya.
Contoh: obyek notaris, maka nama classnya kita sebut CNotaris

setelah itu kita berikan dia properti pengikatan dan plafon. kita anggap properti ini bisa di baca dan bisa di tulis.
properti ini akan terkait dengan variable internal class (private yang hanya di kenal dalam class itu saja)

untuk properti pengikatan, sifatnya adalah integer, di class bisa didefinisikan:




Private int_pengikatan As Integer

Property Let Pengikatan(value As Integer)
    int_pengikatan = value
End Property

Property Get Pengikatan() As Integer
    Pengikatan = int_pengikatan
End Property



untuk properti plafon, sifatnya adalah double, di class di definisikan:

Private dbl_plafon AS Double

Property Let Plafon(value As Double)
    dbl_plafon = value
End Property

Property Get Plafon() As Double
    Plafon = dbl_plafon
End Property




Setiap class saat di instance kan (definisi dengan dim/private) akan membuat obyek baru dan menjalankan constructor (set nilai awal). di Access fungsi bawaannya adalah nama class _ intialize
Saat tidak dibutuhkan lagi, maka destructor nya pun di panggil untuk melepasnya dari memori, yang dijalankan adalah fungsi bawaan nama class _ terminate.
Definisi di classnya adalah:


Private Sub Class_Initialize()
    int_pengikatan = 0
    dbl_plafon = 0
End Sub

Private Sub Class_Terminate()
    'destroy any defined object
End Sub



dan yang terakhir, class notaris ini membutuhkan satu metode menghitung biaya yang sifatnya public.
kita definisikan sebagai fungsi public:


Public Function Biaya() As Double
    Dim dbl_result As Double
   
    If int_pengikatan = 19 Then
        Select Case dbl_plafon
            Case Is < 10000000: dbl_result = 0
            Case Is < 15000000: dbl_result = 7500
            Case Is <= 20000000: dbl_result = 10000
            Case Is > 20000000: dbl_result = 15000
        End Select
    Else
        dbl_result = 0
    End If
    Biaya = dbl_result
End Function


Nah, class kita sudah jadi.
Untuk implementasinya bisa di form, bisa di module.
Saya contohkan yang sederhana saja dengan module.
Buat module baru, dan cukup tuliskan barisan instruksi berikut:



Sub testNotaris()

    Dim notaris As New CNotaris

    notaris.Plafon = 10000000
    notaris.Pengikatan = 19
    Debug.Print notaris.Biaya

    Set notaris = Nothing

End Sub



Sekarang coba jalankan di Immediate Window (tekan Ctrl-G)
lalu ketikkan testNotaris [hit enter]

Silakan dipelajari.
Dalami dengan fungsi debug di VBA editor step into [F8] berkali-kali.


Regards,
Aksan Kurdin









On 10/19/2015 8:56 AM, Aksan Kurdin wrote:
Dear Bang Satria,
Tugasnya bikin class atau bikin module ?

Kalau bikin class, berarti anda bikin 'template' yang berisi properti seperti (pengikatan, plafon) dan metode seperti(Biaya).

jadi di implementasinya bisa berupa:


dim notaris as new CNotaris
notaris.pengikatan = Me.cboPengikatan
notaris.plafon = Me.txtPlafon
Me.txtBiayaNotaris = notaris.Biaya

set notaris = nothing


Regards,
Aksan Kurdin

On 10/7/2015 9:58 AM, Haer Talib haertalib@gmail.com [belajar-access] wrote:
 
Kalau yg saya buatin kemarin itu function bukan sub.
Function bisa dipanggil untuk menghasilkan nilai, kalau sub hanya menjalankan perintah.

Kalau memberi nilai kepada sebuah control (combo atau text box) via VBA, anda harus memberi identifier yang jelas.

Misal: me.pengikatan dan me.Plafon dan me.By_Notaris

Saran saya, pelajari identifier, hal ini fundamental.
Lalu pelajari pula expression, juga fundamental dalam programming.

Good luck!




Haer Talib

RumahAccess Indonesia
Tempatnya Belajar Microsoft Access
Artikel | Forum | Milis | Download | Training | Links | Blog | Event



2015-10-05 16:13 GMT+07:00 satriauad@yahoo.co.id [belajar-access] <belajar-access@yahoogroups.com>:


Sudah saya coba...tapi masih bingung
Punya saya seperti ini

Modul modHitung
=================
Public Sub Notaris()
    Dim Pengikatan As Integer
    Dim Plafon As Currency
    Dim By_Notaris As Currency

    If Pengikatan = 19 And Plafon < 10000000 Then
        By_Notaris = 0
    ElseIf Pengikatan = 19 And Plafon < 15000000 Then
        By_Notaris = 7500
    ElseIf Pengikatan = 19 And Plafon < 20000000 Then
        By_Notaris = 10000
    ElseIf Pengikatan = 19 And Plafon > 20000000 Then
        By_Notaris = 15000
    ElseIf Pengikatan <> 19 Then
        By_Notaris = 0
    End If
End Sub

Terus di form saya 'Call Notaris' tetep ga keluar angkanya

Dimana pengikatan di form adalah combobox, Plafon itu textbox, By_notaris juga textbox
Maaf nih, baru belajar 









__._,_.___

Posted by: satria kusuma <satriauad@yahoo.co.id>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (11)
SPAM IS PROHIBITED

.

__,_._,___

Bls: [belajar-access] Syntax Command Button Hapus

 

Bang Oman,
Sekedar membantu para master, mungkin seperti ini syntax-nya
txtNilai1.Value = 0
txtNilai2.Value = 0
  1. dot Value bukan dot Text
  2. isikan value default 0 (nol) pada txtNilai1 dan txtNilai2 agar penjumlahan tetap dapat terlihat (tidak error)




Pada Jumat, 30 Oktober 2015 13:07, "Oman Rohman rohmanpoenya@yahoo.com [belajar-access]" <belajar-access@yahoogroups.com> menulis:


 
[Attachment(s) from Oman Rohman rohmanpoenya@yahoo.com [belajar-access] included below]
Dear para master access...

Saya punya sedikit permasalahan dengan ms. access, mohon bantuannya untuk memberikan syntax tombol hapus, untuk digunakan pada form yang datanya tidak disimpan ke tabel (tanpa tabel karena datanya tidak perlu disimpan), formnya ada pada lampiran. Sebelumnya Saya ucapkan terima kasih banyak.

Salam hormat,

Oman Rohman


__._,_.___

Posted by: satria kusuma <satriauad@yahoo.co.id>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
SPAM IS PROHIBITED

.

__,_._,___

[MS_AccessPros] Subform didn't show

 

Dear All,
I use use "visible" to show and hide a subform, after input some data, the sub form still didn't show. Please help.

Private Sub Form_Current()
On Error GoTo ErrHandle

If IsNull(Me.GroupBookingID)  Then
Forms!frmGroupBooking!subPart.Visible = True

Else
Forms!frmGroupBooking!subPart.Visible = False
End If

ErrExit:
    Exit Sub
   
ErrHandle:
    Resume ErrExit
End Sub

Best Regards,
Kevin

__._,_.___

Posted by: "zhaoliqingoffice@163.com" <zhaoliqingoffice@163.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___