buat tabel invoice dengan struktur sbb :
nomor int
jual  boolean
retur  boolean

isi tabel invoice dengan nomor diisi oleh angka 1 s/d 1000
jual diisi dengan False dan retur diisi dengan False

Misal : 
buat invoice penjualan
Function Make_Invoice(jenis as string) as string
dim kd as string
dim bl,th as string
dim Cnt as integer
bl=month(date)
th=year(date)
if len(bl)=1 then bl="0" & bl
if jenis="Jual"
   kd="JL"
   Cnt=Get_Nomor_Invoice("jual")
else
   kd="RJL"
   Cnt=Get_Nomor_Invoice("retur")
end if
Make_Invoice=Kd & th & bl & cnt
End Function

Function Get_Nomor_invoice(jenis as string) as integer
DIm Rs as Recordset
Get_Nomor=1
' Asumsi bahwa koneksinya menggunakan variable Cn

Set rs=Cn.Execute("select top 1 nomor from invoice where [" & jenis 
& "]=False order by nomor ")
Get_nomor=rs.fields(0)
rs.close
set rs=nothing
End Function

' untuk mengaksesnya tinggal sbb :
' invoice penjualan
label1.caption=Make_invoice("jual")

untuk invoice return

label1.caption=Make_invoice("retur")

semota membantu

Abufikri
www.solusi-it.com






--- In [email protected], "r_5131n" <[EMAIL PROTECTED]> wrote:
>
> Klo...aku pake konsep..."new"..trus generate numbernya....
> dari new itu...kita bisa liat yng input duluan user yg mana
> dengan cara "New+User"...
> Smog bisa bantu...
> 
> 
> 
> --- In [email protected], "acholyte_rbo" <acholyte_rbo@>
> wrote:
> >
> > Pada mau save ( add new ) query dulu apakah no 10 udah ada atau 
belum
> > karena waktu get nomor sepuluh itu kan masih no temporary belom 
no fix
> > ( no sudah pasti / ada/ tersimpan di database )
> > 
> > Ocre
> > 
> > --- In [email protected], "sunardi_kss" <sunardi_kss@> 
wrote:
> > >
> > > dear para programmer vb
> > > saya buat nomor counter pada program kasir dengan menggunakan
> database 
> > > Ms Access untuk satu komputer jalan sesuai dengan counter 
tersebut. 
> > > saya coba dengan multiuser 2 komputer dengan pada kasir pertama 
nomor 
> > > 10 tapi pada kasir kedua nomor 10 juga maka pada saat disimpan
> datanya 
> > > akan konflik (error).
> > > Bagaimana modulnya untuk kasus saya diatas, mohon bantuan dan 
ilmunya.
> > > 
> > > Terima kasih banyak
> > >
> >
>


Kirim email ke