473,854 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

access 2002 and vba

i have a problem with an db&vba which was written by someone else, but
i have to work on it now. there is a form opened by a vba and instead
of the form there is only a white/grey form without anything on it.
if i start the form itself it says "cannot jump to this data record"
and if i debugg it stops at the marked line. the guy who wrote it told
me it was working...
Option Compare Database
Option Explicit

Private Sub DU_DOWN_Click()
Me!DU2 = Me!DU1
Me!DU1 = Me!DU
Me!DU = ""
End Sub

Private Sub ErgebnisListe_A fterUpdate()
Dim STR As String

STR = "SELECT Person.PN, Person.TITL, Person.NN, Person.VN,
Person.MW, Person.BER, Person.GEB, Person.STR, Person.PLZ,
Person.[EIN], Person.LG, Person.VAZ, Person.CODE1, Person.CODE2,
Person.MBI, Person.STD, Person.REF, Person.VERW, Person.DNGRP1,
Person.DNGRP2, Person.URLAN, Person.URLAQ, Person.ABW, Person.ABWV,
Person.ABWB, Ort.WOO, DU.DU, DU.DU1, DU.DU2 FROM Ort RIGHT JOIN (DU
RIGHT JOIN Person ON DU.PN=Person.PN ) ON Ort.PLZ=Person. PLZ " _
& "WHERE Person.PN="

STR = STR + Me!ErgebnisList e
STR = STR + ";"

Me.RecordSource = STR

Hide_ShowChange Register (True)
End Sub

Private Sub Form_Open(cance l As Integer)
Me!Search1 = "Person.PN"
Me!Search2 = "VN"
Me!Search3 = "NN"
Me!Search1Cmp = "="
Me!Search2Cmp = "="
Me!Search3Cmp = "="

Call Search1_AfterUp date
Call Search2_AfterUp date
Call Search3_AfterUp date

Call New_Search_Clic k
End Sub

Private Sub New_Search_Clic k()
Me!SearchValue1 = Null
Me!SearchValue2 = Null
Me!SearchValue3 = Null
Call Suche_Click
Hide_ShowChange Register (False)

IT STOPS HERE: Me!SearchValue1 .SetFocus
End Sub

Private Sub Hide_ShowChange Register(val As Boolean)
Me!ChangeRegist er.Visible = val
Me!Save.Visible = val
End Sub

Private Sub save_Click()
On Error GoTo Err_Save_Click

DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Me.ErgebnisList e.RowSource = Me.ErgebnisList e.RowSource

MsgBox "Mitarbeite r wurde erfolgreich geändert.", vbInformation +
vbOKOnly, "Informatio n"
writelogfile ("person " & Me!VN & " " & Me!NN & " changed")

Exit_Save_Click :
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click
End Sub
Private Sub Search1_AfterUp date()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordse t("FieldDescrip tionList")

rs.MoveFirst
Do Until rs.EOF
If rs!Field = Me!Search1 Then
If rs!Criteria = "Zahl" Then
Me!Search1Cmp.R owSource = """>"";""="";"" <"""
ElseIf rs!Criteria = "Datum" Then
Me!Search1Cmp.R owSource = """>"";""="";"" <"""
ElseIf rs!Criteria = "Text" Then
Me!Search1Cmp.R owSource = """="""
End If
End If

rs.MoveNext
Loop

rs.close
End Sub

Private Sub Search2_AfterUp date()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordse t("FieldDescrip tionList")

rs.MoveFirst
Do Until rs.EOF
If rs!Field = Me!Search2 Then
If rs!Criteria = "Zahl" Then
Me!Search2Cmp.R owSource = """>"";""="";"" <"""
ElseIf rs!Criteria = "Datum" Then
Me!Search2Cmp.R owSource = """>"";""="";"" <"""
ElseIf rs!Criteria = "Text" Then
Me!Search2Cmp.R owSource = """="""
End If
End If

rs.MoveNext
Loop

rs.close
End Sub

Private Sub Search3_AfterUp date()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordse t("FieldDescrip tionList")

rs.MoveFirst
Do Until rs.EOF
If rs!Field = Me!Search3 Then
If rs!Criteria = "Zahl" Then
Me!Search3Cmp.R owSource = """>"";""="";"" <"""
ElseIf rs!Criteria = "Datum" Then
Me!Search3Cmp.R owSource = """>"";""="";"" <"""
ElseIf rs!Criteria = "Text" Then
Me!Search3Cmp.R owSource = """="""
End If
End If

rs.MoveNext
Loop

rs.close
End Sub
Private Sub SearchValue1_Be foreUpdate(canc el As Integer)

End Sub

Private Sub Suche_Click()
Dim searchquery As String

' Falls alle Suchfelder leer nicht weitersuchen
If Nz(Me!SearchVal ue1, 0) = 0 And Nz(Me!SearchVal ue2, 0) = 0 And
Nz(Me!SearchVal ue3, 0) = 0 Then
searchquery = ""
Me.ErgebnisList e.RowSource = searchquery
Exit Sub
End If

' Datentypen der Kriterien überprüfen
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordse t("FieldDescrip tionList")

rs.MoveFirst
Do Until rs.EOF
If rs!Field = Me!Search1 And Nz(Me!SearchVal ue1, 0) <> 0 Then
If rs!Criteria = "Zahl" Then
If Not IsNumeric(Searc hValue1) Then
MsgBox "Suchkriter ium 1 muss Zahl sein!",
vbInformation + vbOKOnly, "Informatio n"
SearchValue1.Se tFocus
Exit Sub
End If
ElseIf rs!Criteria = "Datum" Then
If Not IsDate(SearchVa lue1) Then
MsgBox "Suchkriter ium 1 entspricht nicht einem
Datum!", vbInformation + vbOKOnly, "Informatio n"
SearchValue1.Se tFocus
Exit Sub
End If
End If
End If

If rs!Field = Me!Search2 And Nz(Me!SearchVal ue2, 0) <> 0 Then
If rs!Criteria = "Zahl" Then
If Not IsNumeric(Searc hValue2) Then
MsgBox "Suchkriter ium 2 muss Zahl sein!",
vbInformation + vbOKOnly, "Informatio n"
SearchValue2.Se tFocus
Exit Sub
End If
ElseIf rs!Criteria = "Datum" Then
If Not IsDate(SearchVa lue2) Then
MsgBox "Suchkriter ium 2 entspricht nicht einem
Datum!", vbInformation + vbOKOnly, "Informatio n"
SearchValue2.Se tFocus
Exit Sub
End If
End If
End If

If rs!Field = Me!Search3 And Nz(Me!SearchVal ue3, 0) <> 0 Then
If rs!Criteria = "Zahl" Then
If Not IsNumeric(Searc hValue3) Then
MsgBox "Suchkriter ium 3 muss Zahl sein!",
vbInformation + vbOKOnly, "Informatio n"
SearchValue3.Se tFocus
Exit Sub
End If
ElseIf rs!Criteria = "Datum" Then
If Not IsDate(SearchVa lue3) Then
MsgBox "Suchkriter ium 3 entspricht nicht einem
Datum!", vbInformation + vbOKOnly, "Informatio n"
SearchValue3.Se tFocus
Exit Sub
End If
End If
End If

rs.MoveNext
Loop
rs.close

' Zusammensetzen der Abfrage für die Liste entspr. den
Suchkriterien
searchquery = "SELECT Person.PN, Person.TITL AS Titel, Person.NN
AS Nachname, Person.VN AS Vorname, " _
& "Person.MW AS Geschlecht, Person.BER AS Beruf,
Person.GEB AS Geburtsdatum, Person.STR AS Strasse, " _
& "Person.PLZ , Ort.WOO AS Ort, Person.[EIN] AS
Eintrittsdatum, Person.LG AS Lohngruppe, Person.VAZ as
Vorarbeiterzula ge, " _
& "Person.COD E1 as Referenzcodeext ern, Person.CODE2 as
Referenzcodeint ern, Person.MBI as Monatsbrutto, Person.STD as
Normalarbeitsze it, Person.REF AS Referenz, Person.VERW as
Verweildauer, Person.DNGRP1 AS Meister, " _
& "Person.DNG RP2 AS Teamleiter, Person.URLAN AS
Urlaubsanspruch Woche, Person.URLAQ AS Urlausbanspruch aliquot, " _
& "Person.ABW AS Abwesenheit, Person.ABWV AS ABWVON,
Person.ABWB AS ABWBIS, DU.DU AS LetzteUmstuf, " _
& "DU.DU1 AS VorletzteUmstuf , DU.DU2 AS
VorvorletzteUms tuf, Code, Monatslohn, Stdl " _
& "FROM Ort, Person, DU, Lohnschema " _
& "WHERE Ort.PLZ = Person.PLZ and
Lohnschema.Lohn gruppe = Person.LG and DU.PN = Person.PN And "

If (Nz(Me!SearchVa lue1, 0) <> 0) Then
If IsDate(Me!Searc hValue1) Then
searchquery = searchquery & Search1 & " " & Search1Cmp & "
#" & Me!SearchValue1 & "# "
ElseIf IsNumeric(Me!Se archValue1) Then
searchquery = searchquery & Search1 & " " & Search1Cmp & "
" & Me!SearchValue1 & " "
Else
searchquery = searchquery & Search1 & " " & "LIKE" & " '"
& Me!SearchValue1 & "*' "
End If

If (Nz(Me!SearchVa lue2, 0) <> 0) Or (Nz(Me!SearchVa lue3, 0) <>
0) Then
searchquery = searchquery & "AND "
End If
End If

If (Nz(Me!SearchVa lue2, 0) <> 0) Then
If IsDate(Me!Searc hValue2) Then
searchquery = searchquery & Search2 & " " & Search2Cmp & "
#" & Me!SearchValue2 & "# "
ElseIf IsNumeric(Me!Se archValue2) Then
searchquery = searchquery & Search2 & " " & Search2Cmp & "
" & Me!SearchValue2 & " "
Else
searchquery = searchquery & Search2 & " " & "LIKE" & " '"
& Me!SearchValue2 & "*' "
End If

If (Nz(Me!SearchVa lue3, 0) <> 0) Then
searchquery = searchquery & "AND "
End If
End If

If (Nz(Me!SearchVa lue3, 0) <> 0) Then
If IsDate(Me!Searc hValue3) Then
searchquery = searchquery & Search3 & " " & Search3Cmp & "
#" & Me!SearchValue3 & "# "
ElseIf IsNumeric(Me!Se archValue3) Then
searchquery = searchquery & Search3 & " " & Search3Cmp & "
" & Me!SearchValue3 & " "
Else
searchquery = searchquery & Search3 & " " & "LIKE" & " '"
& Me!SearchValue3 & "*' "
End If
End If

searchquery = searchquery & ";"
Me.ErgebnisList e.RowSource = searchquery

If Me.ErgebnisList e.ListCount > 1 Then
With Me.ErgebnisList e
.Value = .ItemData(Abs(. ColumnHeads))
Call ErgebnisListe_A fterUpdate
End With
Else
Hide_ShowChange Register (False)
Me!SearchValue1 .SetFocus
End If
End Sub
Nov 13 '05 #1
0 1188

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2659
by: Noesis Strategy | last post by:
When I ordered my new laptop, Sony didn't offer Access 2003 in its bundles. Recently, I have begun to design Access databases using an copy of Access 2002 from my previous laptop. It works fine, but I would like to have all the office apps on the same version. So I have a few questions: 1) Is the file format the same as 2002? Can 2002 users read 2003 files? 2) What are the major reasons for upgrading to 2002 ?
1
5760
by: Wayne Aprato | last post by:
I have a client who is running several Access 97 databases that I have written for them. They are about to upgrade to Access 2003. Is the default file format of Access 2003 still Access 2000 the same as it was in Access 2002? I am running Access 2002 at the moment. Is there any reason for testing purposes etc, for me to purchase Access 2003 if I am going to recompile the Access 97 mdb files into Access 2000 format mde files which...
3
2128
by: Scott | last post by:
Hi, If we want to compile an Access 2002 database and distribute it to others, will the compiled software run on any PC, like Windows 98, Windows 2000, etc. Also, you don't have to have Access 2002 in order to run it do you? Thanks!
7
3469
by: Wayne Aprato | last post by:
I have several Access 2003 mde databases. When I try to open them in Access 2002 I get the following error: "The Visual Basic for Applications project in the database is corrupt." Interestingly I can open the mdb files of the same 2003 databases in Access 2002 without problems. To my understanding the file formats of 2002 and 2003 are the same and this problem shouldn't exist. And why is it only the mde files that are giving the...
6
4770
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
9
2890
by: Rob | last post by:
Scenario: O/S: Win XP Professional Back-end: Access 2002 on network server I have an Access 97 application, in production on our network, that takes appoximately 5 minutes to process monthly data. I find this tolerable. The Access 2002 test version, on the network, takes approximately 50
2
1783
by: Bruce Dodds | last post by:
I will be doing an app for a nonprofit. It would be useful for them to have a good entry-level book on Access so that they don't have to pay someone to design all their queries and reports. I'm not familiar with those books. Does anyone have a recommendation? TIA.
9
4332
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access application as the data source, and then performs a merge. Everything works fine. However, when a user uses it in Access 2002 and Word 2002, an extra instance of the Access application is opened and remains open at the end. Sometimes it remains open
52
10019
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server 2005, and, since he already has licenses for Office Pro 2002, he wants to upgrade to that. I've been saying that we need to upgrade to Access 2003, not 2002, even if Office is kept at 2002. We are also looking to do a fair amount of...
0
2765
by: Sebastian | last post by:
Hello I develop my applications in Access 2002. My development system is running Windows XP SP2 and I have Microsoft Office XP Developer. Microsoft Office XP is at SP3. I used Inno Setup (great product) to install my applications. When the Access Runtime was needed on the system I simply ran 'accessrt.msi' from Microsoft Office Developer discs. When another version of Access (other than Access 2002) was on the system then I simply...
0
9750
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11024
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9510
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7909
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7077
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
4150
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.