otomatik sayı hakkında

Katılım
2 Ocak 2007
Mesajlar
148
Excel Vers. ve Dili
office xp
arkadaşlar bir ara bir soru vardı şimdi bulamıyorum.

aynı tablodaki farklı ürünler için otomatik sayı kendi içinde ilerlesin istiyorum. bunun cevabı vardı ama şimdi bulamıyorum....
 
Katılım
22 Ocak 2007
Mesajlar
815
Excel Vers. ve Dili
2003
cevap

Tablo1 diye bir tablomuz var içinde ADI=metin SIRA=sayı diye iki alan var
formda sıra alanının veri kısmında etkin hayır kilitli evet dedik formun ekleme sonrasına kodu yazdıkki kayıt ekledikten sonra tablodaki bütün alanları kontrol etsin sonrada aynı ise sırayı 1 artırsın değilse 1 den başlasın dedik

Private Sub Form_AfterInsert()
'burda i diye bir sanal alan yaptık
Dim i As Integer
'burda rs diye bir recorset oluşturduk
Dim rs As New ADODB.Recordset
'burda oluşturduğumuz recorsete bir tablo gösterip onu açmasını söyledik
rs.Open "Tablo1", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
'burda açılan tablonun ilk kaydına gitmesini söyledik
rs.MoveFirst
'burda oluşturduğumuz sanal alana 0 değeri atadık
i = 0
'burda açılan tabloda veri varmı yokmu onu kontrol ediyoruz
If rs.EOF <> True Then
Do
'burda tablodaki ADI alanıyla Formdaki ADI alanını karşılaştırıyoruz benzeyenleri
If Nz(rs("ADI")) = Nz(ADI.Value) Then
'burda saydırıyoruz
i = i + 1
'burda ise o saydırdığımız sayıyı eklediğimizde dahil alana yazdırıyoruz
SIRA.Value = i
End If
'Burda eğer benzersiz bir kayıt yazdıysak ona bakıyor kod
If Nz(rs("ADI")) <> Nz(ADI.Value) Then
'burda ise o benzersiz kaydın sırasına 1 yazıyor
SIRA.Value = 1
End If
'burda bu işlemleri tüm tablodaki kayıtlar bitene kadar sonraki kayıt diyerek döndürüyoruz
rs.MoveNext
Loop Until rs.EOF
End If
'burda ise son kayda geldiğinde açılan tabloyu kapatıyor
Set rs = Nothing
Set conn = Nothing
End Sub

kodda başlara konulan Nz işleci eğer siz büyük yada küçük harf girerseniz bunu önemseme sen yinede karşılaştır demektir
 
Katılım
25 Aralık 2005
Mesajlar
4,160
Excel Vers. ve Dili
MS Office 2010 Pro Türkçe
kodda başlara konulan Nz işleci eğer siz büyük yada küçük harf girerseniz bunu önemseme sen yinede karşılaştır demektir
Sayın gülsüm1 bir hata yapıyorsunuz sanırım. Nz fonksiyonu null zero kelimelerinin baş harflerinden adını almış bir fonksiyon. Bu fonksiyon eğer kayıt boş ise nasıl davranılacağını anlatır. Küçük veya büyük harf duyarlılığıyla ilişkisi yok.

İyi çalışmalar:)
 
Katılım
2 Ocak 2007
Mesajlar
148
Excel Vers. ve Dili
office xp
arkada&#351;lar &#231;ok te&#351;ekk&#252;r ederim.
eski sorular forumda yok bu k&#246;t&#252; bir durum.
bunlar&#305;n bir ar&#351;ivi yap&#305;l m&#305;yorsa her&#351;ey bo&#351;a gidiyor demektir. do&#287;ru mu?
 
Katılım
22 Ocak 2007
Mesajlar
815
Excel Vers. ve Dili
2003
kodu ben yazd&#305;m ne oldu&#287;unu gayet iyi biliyorum hata yapm&#305;yorum ben kodu yazarken b&#252;y&#252;k k&#252;&#231;&#252;k harf yaz&#305;l&#305;nca sayma yapm&#305;yordu ondan Nz koydum oldu bu ama&#231;la kulland&#305;m i&#351;e yarar yaramaz &#246;nemli olan soruyu soran ki&#351;inin i&#351;inin bitmesidir.
 
Katılım
25 Aralık 2005
Mesajlar
4,160
Excel Vers. ve Dili
MS Office 2010 Pro Türkçe
Sayın gülsüm1,

Polemik yaratmadan lütfen kod yazma sayfasına geçim Nz yazın ve F1 basın çıkan pencereden Nz nin ne olduğunu okuyun ben sadece yanlış anlamanın oluşmamasını istiyorum.

Sizin bu şekildeki davranışlarınız ne yazık ki bir çok değerli arkadaşların forumdan ayrılmasına neden oldu.
 
Katılım
22 Ocak 2007
Mesajlar
815
Excel Vers. ve Dili
2003
say&#305;n modal&#305; polemi&#287;e girmiyorum ayr&#305;lanlar benim y&#252;z&#252;mdenmi de&#287;ilmi bilmem bir ki&#351;i bana senin y&#252;z&#252;nden ayr&#305;l&#305;yorum derse ben formdan ayr&#305;l&#305;r&#305;m ben burda sadece yard&#305;m amac&#305;yla var&#305;m i&#351;lerimden kalan zamanlarda bilgimin elverdi&#287;ince yard&#305;m ediyorum senin yard&#305;m&#305;na ihtiya&#231;lar&#305; yok bu formdaki ki&#351;ilerin dersen ben ayr&#305;l&#305;r&#305;m
 
Katılım
25 Aralık 2005
Mesajlar
4,160
Excel Vers. ve Dili
MS Office 2010 Pro Türkçe
Sayın arkadaşlar Nz fonksiyonunun kullanışı ile ilgili Access in yardım dosyalarındaki bilgi şöyle:

Nz Function

See AlsoApplies ToExampleSpecifics
You can use the Nz function to return zero, a zero-length string (" "), or another specified value when a Variant is Null. For example, you can use this function to convert a Null value to another value and prevent it from propagating through an expression.
Nz(variant, [valueifnull])
The Nz function has the following arguments.
ArgumentDescriptionvariantA variable of data type Variant.valueifnullOptional (unless used in a query). A Variant that supplies a value to be returned if the variant argument is Null. This argument enables you to return a value other than zero or a zero-length string. Note If you use the Nz function in an expression in a query without using the valueifnull argument, the results will be a zero-length string in the fields that contain null values.


If the value of the variant argument is Null, the Nz function returns the number zero or a zero-length string (always returns a zero-length string when used in a query expression), depending on whether the context indicates the value should be a number or a string. If the optional valueifnull argument is included, then the Nz function will return the value specified by that argument if the variant argument is Null. When used in a query expression, the NZ function should always include the valueifnull argument,
If the value of variant isn't Null, then the Nz function returns the value of variant.
Remarks

The Nz function is useful for expressions that may include Null values. To force an expression to evaluate to a non-Null value even when it contains a Null value, use the Nz function to return zero, a zero-length string, or a custom return value.
For example, the expression 2 + varX will always return a Null value when the Variant varX is Null. However, 2 + Nz(varX) returns 2.
You can often use the Nz function as an alternative to the IIf function. For example, in the following code, two expressions including the IIf function are necessary to return the desired result. The first expression including the IIf function is used to check the value of a variable and convert it to zero if it is Null.
varTemp = IIf(IsNull(varFreight), 0, varFreight)varResult = IIf(varTemp > 50, "High", "Low") In the next example, the Nz function provides the same functionality as the first expression, and the desired result is achieved in one step rather than two.
varResult = IIf(Nz(varFreight) > 50, "High", "Low") If you supply a value for the optional argument valueifnull, that value will be returned when variant is Null. By including this optional argument, you may be able to avoid the use of an expression containing the IIf function. For example, the following expression uses the IIf function to return a string if the value of varFreight is Null.
varResult = IIf(IsNull(varFreight), "No Freight Charge", varFreight) In the next example, the optional argument supplied to the Nz function provides the string to be returned if varFreight is Null.
varResult = Nz(varFreight, "No Freight Charge") Example

The following example evaluates a control on a form and returns one of two strings based on the control's value. If the value of the control is Null, the procedure uses the Nz function to convert a Null value to a zero-length string.
Public Sub CheckValue() Dim frm As Form Dim ctl As Control Dim varResult As Variant ' Return Form object variable pointing to Orders form. Set frm = Forms!Orders ' Return Control object variable pointing to ShipRegion. Set ctl = frm!ShipRegion ' Choose result based on value of control. varResult = IIf(Nz(ctl.Value) = vbNullString, _ "No value.", "Value is " & ctl.Value & ".") ' Display result. MsgBox varResult, vbExclamationEnd Sub
 
Katılım
22 Ocak 2007
Mesajlar
815
Excel Vers. ve Dili
2003
cevap

sayın modalı formdaki kişiler eğer sizin gönderdiğiniz gibi access yardımdaki her şeyi anlasalardı formda sana bana iş düşmezdi eğer insanlar bu gönderdiğimden bir şey anlasalardı yukarda benim yazdığım kodu çooooooooooooook basit bir şekilde yazarlardı Recordset Object
Represents the entire set of records from a base table or the results of an executed command. At any time, the Recordset object refers to only a single record within the set as the current record.





You use Recordset objects to manipulate data from a provider. When you use ADO, you manipulate data almost entirely using Recordset objects. All Recordset objects consist of records (rows) and fields (columns). Depending on the functionality supported by the provider, some Recordset methods or properties may not be available.

ADODB.Recordset is the ProgID that should be used to create a Recordset object. Existing applications that reference the outdated ADOR.Recordset ProgID will continue to work without recompiling, but new development should reference ADODB.Recordset.

There are four different cursor types defined in ADO:

Dynamic cursor — allows you to view additions, changes, and deletions by other users; allows all types of movement through the Recordset that doesn't rely on bookmarks; and allows bookmarks if the provider supports them.
Keyset cursor — behaves like a dynamic cursor, except that it prevents you from seeing records that other users add, and prevents access to records that other users delete. Data changes by other users will still be visible. It always supports bookmarks and therefore allows all types of movement through the Recordset.
Static cursor — provides a static copy of a set of records for you to use to find data or generate reports; always allows bookmarks and therefore allows all types of movement through the Recordset. Additions, changes, or deletions by other users will not be visible. This is the only type of cursor allowed when you open a client-side Recordset object.
Forward-only cursor — allows you to only scroll forward through the Recordset. Additions, changes, or deletions by other users will not be visible. This improves performance in situations where you need to make only a single pass through a Recordset.
Set the CursorType property prior to opening the Recordset to choose the cursor type, or pass a CursorType argument with the Open method. Some providers don't support all cursor types. Check the documentation for the provider. If you don't specify a cursor type, ADO opens a forward-only cursor by default.

If the CursorLocation property is set to adUseClient to open a Recordset, the UnderlyingValue property on Field objects is not available in the returned Recordset object. When used with some providers (such as the Microsoft ODBC Provider for OLE DB in conjunction with Microsoft SQL Server), you can create Recordset objects independently of a previously defined Connection object by passing a connection string with the Open method. ADO still creates a Connection object, but it doesn't assign that object to an object variable. However, if you are opening multiple Recordset objects over the same connection, you should explicitly create and open a Connection object; this assigns the Connection object to an object variable. If you do not use this object variable when opening your Recordset objects, ADO creates a new Connection object for each new Recordset, even if you pass the same connection string.

You can create as many Recordset objects as needed.

When you open a Recordset, the current record is positioned to the first record (if any) and the BOF and EOF properties are set to False. If there are no records, the BOF and EOF property settings are True.

You can use the MoveFirst, MoveLast, MoveNext, and MovePrevious methods; the Move method; and the AbsolutePosition, AbsolutePage, and Filter properties to reposition the current record, assuming the provider supports the relevant functionality. Forward-only Recordset objects support only the MoveNext method. When you use the Move methods to visit each record (or enumerate the Recordset), you can use the BOF and EOF properties to determine if you've moved beyond the beginning or end of the Recordset.

Recordset objects can support two types of updating: immediate and batched. In immediate updating, all changes to data are written immediately to the underlying data source once you call the Update method. You can also pass arrays of values as parameters with the AddNew and Update methods and simultaneously update several fields in a record.

If a provider supports batch updating, you can have the provider cache changes to more than one record and then transmit them in a single call to the database with the UpdateBatch method. This applies to changes made with the AddNew, Update, and Delete methods. After you call the UpdateBatch method, you can use the Status property to check for any data conflicts in order to resolve them.

Note To execute a query without using a Command object, pass a query string to the Open method of a Recordset object. However, a Command object is required when you want to persist the command text and re-execute it, or use query parameters.
The Mode property governs access permissions.

The Fields collection is the default member of the Recordset object. As a result, the following two code statements are equivalent.

Debug.Print objRs.Fields.Item(0) ' Both statements print
Debug.Print objRs(0) ' the Value of Item(0).
See Also
Recordset Object Properties, Methods, and Events | Connection Object | Fields Collection | Properties Collection | Appendix A: Providers

çünkü burda her şey var sadece ingilizce bilmek gerekiyor sizce bu formda bu derece ingilizce bilen kaç kişi çıkar demem oki madem bir iyilik yapacaksınız yukardakini anlayacak kadar ingilizce biliyorsunuz access içinde visual basic yardımını türkçeye çevirin ve buraya ekleyinki formdaki herkes ve ben faydalanalım ben ingilizce bilmem ama kod yazarım işime yarayan bir kaç kelime bilirim oda benim işimi görür ayrıca ben sadece çözüm üretirim çözümü hakkında bilgim olmadığı bir konuda yorum yapmam ve öğretmek için özellikle açıklayarak anlatırım tek tek tane tane nasıl yapıldığı hangi kısmının ne işe yaradığı gibi size bana gelen bir mesajı örnek olarak göndereyim ne demek istediğimi anlarsınız

Sn.Gülsüm Merhaba;

Sizi özel mesaj atarak rahatsız ettiğim için özür dilerim. .............................. bir soru sormuştum bu çalışma arkadaşlarımın aylık bildirimde kulladığı bir form içindi. Alt birimlerin bir ay boyunca yaptığı etkinliklerin birleştirerek bir üs kuruma bildiriyorlar. Genelliklede alt birimler eksik yada yanlış form gönderiyorlarki o da arakadaşların işini bir hayli zorlaştırıyor. Forma soruyu sorduğumda .....................................diye bahsetnmiştim sizde prensip olarak programın tamamı olmadan yardım etmiyorum diye yazdınız. Siz haklı olarak sizden yardımalanların sonradan programı formdaki arakadaşlardan gizlediğinini ve mdb yaparak kod ları sakladığını bildiğiniz için bu kararı aldığınızı biliyorum. Benim böyle bir amacım yok banimde amacım diğer çalışan arakadaşlarıma yardım etmek. Ben formda kolay, kolay soru sormamaya gayret gösteriyorum. Önceden sorulan sorulardan yararlanıp bi şeyler yapıp kendi çalıştığım ve diğer kurumlarda çalışanlara az da olsa yardımcı olamaya çalışıyorum. Bundan bir sene önce ADO kodlamanın nasıl yapıldığını ve bunun hayal olduğunu düşünüyordum ama son zamanlarda sizin arkadaşlara yaptığınız yardımlarda ADO kullanarak yaptığınız programlar parayla kursa gidip öğrenmeye çalışsak da öğrenemeyiz. Sizin sayenizde ADO kodlarının sanıldığı gibi zor olmadığını yavaş, yavaş anlamaya çalıyorum. Bunları yağcılk olsun diye yazmıyorum. Sizi formda bazı kişilerin eleştirdiğinide görüyorum, eleştirenler madem çok biliyorlardı niye sorulara sizin gibi profesyonelce cevap verimiyorlar. Meyve veren ağaç taşlanır hesabı yapıyorlar.

Başınızı ağrıtım kusura bakmayın. Sorulan sorulara profesyonelce verdiğiniz cevaplardan dolayı teşekkür ederim.

Sağlıcaklakalın.
 
Son düzenleme:
Katılım
21 Ekim 2006
Mesajlar
100
Excel Vers. ve Dili
Excel2003 Tr
Arkadaşlar, iyi niyetli olduğunuzdan şüphem yok. Çoğu kişiye bu forumda yardımcı olduğunuzu da biliyorum. İngilizce olarak yapıştırdığınız açıklamayı kaç kişi okuyup anlayacak. Bence Türkçe olarak bu açıklamayı yapıştırırsanız daha faydalı olacağından eminim. Katılımcılar burada ingilizce öğrenme zahmetine katlanmaz diye düşünüyorum. Sayın Gülsüm1, size akıl vermek gibi olmasın da forumda soru soran kişiler örneğini eklediyse onun üzerinde düzeltmeyi yapıp eklemek konunun anlaşılması için zaman kaybını önleyecektir ve polemiklere girilmeyecektir diye düşünüyorum. Böyle olmayınca ard arda sorular soruluyor.
Amaç bu forumda en iyi şekilde yardımcı olmak, bilgileri paylaşmaksa bu konulara da uyalım. Teşekkür erder iyi çalışmalar dilerim.
 
Üst