Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I have a problem and I don't

Status
Not open for further replies.

tatlikiz13

Technical User
May 7, 2003
8
BE
Hi,

I have a problem and I don't know how to solve it.
I have 3 tables and the first one is linked to the other 2 and I have a report where some calculations are done based on a query. In this query I have fields with the calculations for some txtFields on the report.

Is it possible to call ee User Defined Function with the necessary parameters to do for example 1 of the 2 calculations looking at the parameters that I have passed from the tables I have created.

Can someone help me with this??

Thanx
 
Why not use the query that performs the calculations in the current query?
 
It sounds possible, but I would need a few more details before I could confirm, but bear in mind, that when calling a function from a query it is called for every row returned so it can have quite an overhead on a query and you can find a fast query can then take minutes to run.
 
I have decided to put this aside for a while because I have another problem.

I have created a form frmLogin and the code behind this form goes like this:

Private Sub cmdOK_Click()
Dim db As Database
Dim rs As Recordset
Dim teller As Integer

teller = 0
teller = teller + 1

Set db = CurrentDb
Set rs = db.OpenRecordset("select * from tblPaswoord")

If rs.RecordCount > 0 Then
rs.MoveFirst
End If

gebruiker = rs!Gebruikersnaam

Do Until rs.EOF
If rs!Gebruikersnaam = Me!txtGNaam Then
MsgBox "Gebruikersnaam" & vbNewLine & Me!txtGNaam & vbNewLine & "is gevonden", vbInformation, "Gevonden"
If rs!Paswoord = Me!txtPaswoord Then
MsgBox "Paswoord" & vbNewLine & Me!txtPaswoord & vbNewLine & "is gevonden", vbInformation, "Gevonden"
DoCmd.Close acForm, "frmLogin"
DoCmd.OpenForm "frmHoofdmenu"
Exit Do

Else
MsgBox "Paswoord" & vbNewLine & Me!txtPaswoord & vbNewLine & "komt niet overeen met de gebruikersnaam", vbCritical, "Waarschuwing"
teller = teller + 1
Me!txtPaswoord = Null
Me!cmdWissen.SetFocus
Me!txtPaswoord.SetFocus
'Exit Do

End If

Else
'MsgBox "Gebruikersnaam" & vbNewLine & Me!txtGNaam & vbNewLine & "niet gevonden", vbCritical, "Waarschuwing"
Me!txtGNaam = Null
'Me!cmdWissen.SetFocus
Me!txtGNaam.SetFocus
teller = teller + 1

End If

rs.MoveNext
Loop

If teller = 3 Then
MsgBox "Toegang geweigerd!"
DoCmd.Quit acQuitSaveNone
End If

rs.Close
db.Close
End Sub

'If you click the OK button this procedure is being performed, this doesn't appropriately and I can't see the problem.

'Besides this code I have written code behind the textfields :

Private Sub txtGNaam_LostFocus()
If InStr(1, Me.txtGNaam, " ", vbTextCompare) Then
MsgBox "Er mag geen spatie voorkomen in de gebruikersnaam!!", vbInformation
Me.txtGNaam.Value = ""
cmdWissen.SetFocus
txtGNaam.SetFocus
End If
If Trim(txtGNaam.Text) <> &quot;&quot; Then
txtPaswoord.Enabled = True
txtPaswoord.SetFocus
Else
If Trim(txtGNaam.Text) = &quot;&quot; Then
MsgBox &quot;Vul het gebruikersnaam in&quot;, vbCritical + vbOKOnly, &quot;Waarschuwing&quot;
cmdWissen.SetFocus
txtGNaam.SetFocus
End If
End If
Me.txtGNaam.Value = StrConv(txtGNaam, vbProperCase)
End Sub

Private Sub txtPaswoord_LostFocus()
If Trim(txtPaswoord.Text) <> &quot;&quot; Then
cmdOK.Enabled = True
cmdOK.SetFocus
Else
If Trim(txtPaswoord.Text) = &quot;&quot; Then
MsgBox &quot;U moet een paswoord intikken&quot;, vbCritical + vbOKOnly, &quot;Waarschuwing&quot;
cmdWissen.SetFocus
txtPaswoord.SetFocus
End If

End If
Me.txtPaswoord.Value = StrConv(txtPaswoord, vbUpperCase)
End Sub

'this gives also problems when I want to close this form. It asks me to give up the username because it is empty. The program shouldn't ask me this.


Can you help me with this?

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top