473,383 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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_AfterUpdate()
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!ErgebnisListe
STR = STR + ";"

Me.RecordSource = STR

Hide_ShowChangeRegister (True)
End Sub

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

Call Search1_AfterUpdate
Call Search2_AfterUpdate
Call Search3_AfterUpdate

Call New_Search_Click
End Sub

Private Sub New_Search_Click()
Me!SearchValue1 = Null
Me!SearchValue2 = Null
Me!SearchValue3 = Null
Call Suche_Click
Hide_ShowChangeRegister (False)

IT STOPS HERE: Me!SearchValue1.SetFocus
End Sub

Private Sub Hide_ShowChangeRegister(val As Boolean)
Me!ChangeRegister.Visible = val
Me!Save.Visible = val
End Sub

Private Sub save_Click()
On Error GoTo Err_Save_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Me.ErgebnisListe.RowSource = Me.ErgebnisListe.RowSource

MsgBox "Mitarbeiter wurde erfolgreich geändert.", vbInformation +
vbOKOnly, "Information"
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_AfterUpdate()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("FieldDescriptionList")

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

rs.MoveNext
Loop

rs.close
End Sub

Private Sub Search2_AfterUpdate()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("FieldDescriptionList")

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

rs.MoveNext
Loop

rs.close
End Sub

Private Sub Search3_AfterUpdate()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("FieldDescriptionList")

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

rs.MoveNext
Loop

rs.close
End Sub
Private Sub SearchValue1_BeforeUpdate(cancel As Integer)

End Sub

Private Sub Suche_Click()
Dim searchquery As String

' Falls alle Suchfelder leer nicht weitersuchen
If Nz(Me!SearchValue1, 0) = 0 And Nz(Me!SearchValue2, 0) = 0 And
Nz(Me!SearchValue3, 0) = 0 Then
searchquery = ""
Me.ErgebnisListe.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.OpenRecordset("FieldDescriptionList")

rs.MoveFirst
Do Until rs.EOF
If rs!Field = Me!Search1 And Nz(Me!SearchValue1, 0) <> 0 Then
If rs!Criteria = "Zahl" Then
If Not IsNumeric(SearchValue1) Then
MsgBox "Suchkriterium 1 muss Zahl sein!",
vbInformation + vbOKOnly, "Information"
SearchValue1.SetFocus
Exit Sub
End If
ElseIf rs!Criteria = "Datum" Then
If Not IsDate(SearchValue1) Then
MsgBox "Suchkriterium 1 entspricht nicht einem
Datum!", vbInformation + vbOKOnly, "Information"
SearchValue1.SetFocus
Exit Sub
End If
End If
End If

If rs!Field = Me!Search2 And Nz(Me!SearchValue2, 0) <> 0 Then
If rs!Criteria = "Zahl" Then
If Not IsNumeric(SearchValue2) Then
MsgBox "Suchkriterium 2 muss Zahl sein!",
vbInformation + vbOKOnly, "Information"
SearchValue2.SetFocus
Exit Sub
End If
ElseIf rs!Criteria = "Datum" Then
If Not IsDate(SearchValue2) Then
MsgBox "Suchkriterium 2 entspricht nicht einem
Datum!", vbInformation + vbOKOnly, "Information"
SearchValue2.SetFocus
Exit Sub
End If
End If
End If

If rs!Field = Me!Search3 And Nz(Me!SearchValue3, 0) <> 0 Then
If rs!Criteria = "Zahl" Then
If Not IsNumeric(SearchValue3) Then
MsgBox "Suchkriterium 3 muss Zahl sein!",
vbInformation + vbOKOnly, "Information"
SearchValue3.SetFocus
Exit Sub
End If
ElseIf rs!Criteria = "Datum" Then
If Not IsDate(SearchValue3) Then
MsgBox "Suchkriterium 3 entspricht nicht einem
Datum!", vbInformation + vbOKOnly, "Information"
SearchValue3.SetFocus
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
Vorarbeiterzulage, " _
& "Person.CODE1 as Referenzcodeextern, Person.CODE2 as
Referenzcodeintern, Person.MBI as Monatsbrutto, Person.STD as
Normalarbeitszeit, Person.REF AS Referenz, Person.VERW as
Verweildauer, Person.DNGRP1 AS Meister, " _
& "Person.DNGRP2 AS Teamleiter, Person.URLAN AS
UrlaubsanspruchWoche, Person.URLAQ AS Urlausbanspruchaliquot, " _
& "Person.ABW AS Abwesenheit, Person.ABWV AS ABWVON,
Person.ABWB AS ABWBIS, DU.DU AS LetzteUmstuf, " _
& "DU.DU1 AS VorletzteUmstuf, DU.DU2 AS
VorvorletzteUmstuf, Code, Monatslohn, Stdl " _
& "FROM Ort, Person, DU, Lohnschema " _
& "WHERE Ort.PLZ = Person.PLZ and
Lohnschema.Lohngruppe = Person.LG and DU.PN = Person.PN And "

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

If (Nz(Me!SearchValue2, 0) <> 0) Or (Nz(Me!SearchValue3, 0) <>
0) Then
searchquery = searchquery & "AND "
End If
End If

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

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

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

searchquery = searchquery & ";"
Me.ErgebnisListe.RowSource = searchquery

If Me.ErgebnisListe.ListCount > 1 Then
With Me.ErgebnisListe
.Value = .ItemData(Abs(.ColumnHeads))
Call ErgebnisListe_AfterUpdate
End With
Else
Hide_ShowChangeRegister (False)
Me!SearchValue1.SetFocus
End If
End Sub
Nov 13 '05 #1
0 1156

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

Similar topics

13
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,...
1
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...
3
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...
7
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." ...
6
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...
9
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...
2
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...
9
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...
52
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.