PDA

Click to See Complete Forum and Search --> : HELP PLEASE


Sep 10th, 2000, 02:00 AM
I have access 2000 and im developing an aplication and i have to use access97 to access the database otherwise if i use ADODC i cant display the picture in the database. Also im trying to use a field in the database to calculate how many years and moths are between the date in my database and the current date, but its not working. And how can i save pictures in my access database from my app.

This is the code to the proyect:


Thaks

Option Explicit
Public txt_busqueda As String
Dim Busqueda As String
Dim FF As Date


Private Sub Command1_Click()
On Error GoTo AddErr
With Data1.Recordset
.AddNew
If .EOF Then .MoveLast
End With

Exit Sub
AddErr:
MsgBox Err.Description
End Sub

Private Sub Command2_Click()
On Error GoTo DeleteErr
With Data1.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
Exit Sub
DeleteErr:
MsgBox Err.Description
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Command4_Click()
Mantenimiento.WindowState = 1
End Sub

Private Sub Command44_Click()
Busqueda1.Show
Mantenimiento.Hide
End Sub

Private Sub Command5_Click()
On Error GoTo UpdateErr
Data1.Recordset.Update
Exit Sub
UpdateErr:
MsgBox Err.Description, , "Maestro de Pacientes"
End Sub

Private Sub Command6_Click()
Data1.Recordset.Edit
Data1.Recordset.Update
Mantenimiento.Refresh
End Sub

Private Sub Desig_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
End Sub

Private Sub Form_Load()
FF = Int(DateDiff("y", CDate("Data1.Recordset.fields(3)"), Date) / 365.25)
Text8.Text = FF
End Sub

Private Sub Nombre_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
End Sub

Private Sub Cia_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
End Sub

spud
Sep 10th, 2000, 03:22 PM
I got this of the net and I used it in my database, this isn't set up for that but Im sure you can fill in the gaps,


Function Agecal(myDate As Variant) As Integer
myDate = CDate(Text1)
Dim Totdays As Long
Totdays = DateDiff("y", myDate, Date) ' Total Number of days
Step1 = Abs(Totdays / 365.25) ' Number of years
Step2 = (Step1 - Int(Step1)) * 365.25 / 30.435 'Number of months
Step3 = CInt((Step2 - Int(Step2)) * 30.435) ' Number of days


If myDate < Date Then
Label1 = "It has been: " & Int(Step1) & " Year(s) " & Int(Step2) & " Month(s) " & Int(Step3) & " Day(s)" & " Since that date"
Else
Label1 = " There are: " & Int(Step1) & " Year(s) " & Int(Step2) & " Month(s) " & Int(Step3) & " Day(s)" & " To this date"
End If
End Function


Private Sub Command1_Click()


If IsDate(Text1) = False Then
MsgBox " Please enter a valid date. "
Text1.SetFocus
Text1.SelStart = 0: Text1.SelLength = Len(Text1)
Exit Sub
End If
Agecal (myDate)
End Sub



Just Cut and paste,

Dont know how to do the rest but I'm sure someone will help


Spud