Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 19th, 2005, 05:49 AM
Akdor 1154 Akdor 1154 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Center Canyon in a Raptor
Posts: 34 Akdor 1154 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 28 m 44 sec
Reputation Power: 4
Get Data From Previous

Hi,

I'm trying to get a 'get data from previous record' function to work, but, well, it doesn't.

It's *meant* to get the name of the current control,
go back to the previous record,
select the control of the same name,
copy the data to a variable,
go back to the first record,
set it to the variable with the data from the prev. record.

I get told i have an "Invalid use of 'Null'"

Code:
Option Compare Database
Option Explicit

'------------------------------------------------------------
' SetSameAsPrev
'
'------------------------------------------------------------

Function SetSameAsPrev()
On Error GoTo _Error
    Dim CurrentControl As String
    Let CurrentControl = Screen.ActiveControl.Name
    DoCmd.GoToRecord acForm, "Pokédex", acPrevious, 1
    Eval ("DoCmd.GoToControl Forms!Pokédex!CurrentControl")
    Dim PrevValue As String
    Eval ("PrevValue = Forms!Pokédex!CurrentControl.Value")
    DoCmd.GoToRecord acForm, "Pokédex", acNext, 1
    Eval ("Forms!Pokédex!CurrentControl.Value = PrevValue")


_Exit:
    Exit Function

_Error:
    MsgBox Error$
    Resume _Exit

End Function


Any ideas?

I'm using Access 97, if it makes any difference - I've been deciding whether to upgrade, but... nah. - MySQL does all I need; Access is just a convenience. If this doesn't work I'll just use a PHP script.

Reply With Quote
  #2  
Old April 20th, 2005, 05:26 AM
Akdor 1154 Akdor 1154 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Center Canyon in a Raptor
Posts: 34 Akdor 1154 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 28 m 44 sec
Reputation Power: 4
ROFLMAO, this is one of those times you should use Google FIRST. Turns out there's a handy keyboard shortcut that does just this - CTRL+'


Reply With Quote
  #3  
Old April 21st, 2005, 01:29 PM
MarkL23 MarkL23 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 9 MarkL23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 34 sec
Reputation Power: 0
I'm not quite sure what Akdor's referring to. Anyways, maybe I'm missing something with your code, but I think I know where you're getting an error from with it. Does this code execute for each record as that record is accessed? If so, then when you access the first record, there is NO previous record to go to. Maybe adding a check for BOF.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Get Data From Previous


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT