View Full Version : My most favorite: How to ?


Beastie
07-31-2008, 09:37 PM
Hi, I need help with defining the forms source as the latest row of the table - and I need to give the report this if/thens as I have in Form - they affect number of the document (I need to in every open increase ++)
Private Sub Form_Open(Cancel As Integer)
If (Text70.Value) = "Hamrozi František" Then
text8.Value = "000"
End If
//these if are there multiply, only the name and the number is changing//
znacka.Value = Int(znacka.Value) + Int(1)
//this I hope will do the increasing
End Sub

The problem is, that the text70.value is a combobox based on column and I need it to log the last row in the table. (it would do the drill just for this combo , not the form actually)
Please help :)
Bye Tess

Fifty2One
08-02-2008, 09:12 AM
I think you need to define a temporary vairable to hold the value of the next znacka then use Dmax to find the highest value of znacka in the database and let the temporary variable equal the max of znacka plus one. Then introduce this number inside your IF statement.


Hi, I need help with defining the forms source as the latest row of the table - and I need to give the report this if/thens as I have in Form - they affect number of the document (I need to in every open increase ++)
Private Sub Form_Open(Cancel As Integer)
If (Text70.Value) = "Hamrozi František" Then
text8.Value = "000"
End If
//these if are there multiply, only the name and the number is changing//
znacka.Value = Int(znacka.Value) + Int(1)
//this I hope will do the increasing
End Sub

The problem is, that the text70.value is a combobox based on column and I need it to log the last row in the table. (it would do the drill just for this combo , not the form actually)
Please help :)
Bye Tess

boblarson
08-02-2008, 09:21 AM
When you say "I need it to log the last row in the table" I hope you have a way to determine that it is the last row in the table because Access does not store records behind the scenes in any particular order. What you think is that it is stored sequentially based on when you enter them and that is simply not the case. So, if you want to identify the last row entered you would need to supply it with something like a date/time stamp to be able to reliably pull the data you want and then use a query or domain aggregate to get that value.