PC Review


Reply
Thread Tools Rate Thread

datasheet in subform

 
 
spieters via AccessMonster.com
Guest
Posts: n/a
 
      30th May 2007
L.S.

I'm trying to enable a specific field in a datasheet subform, but all the
records in the subform get the same data.
I'm using this coding to update the fields in the subform.
Thanks in advance for your help.

Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset
Dim dbs As DAO.Database
Dim varX As Variant
Set dbs = CurrentDb

Set rst = Nothing
Set rst1 = Nothing
Set subform = Forms!Frminstruments!FrmSubinstrument.Form
Set Mainform = Forms!Frminstruments

SQL = "Select [Calibration Cycle]" & _
" FROM TblIDseq Where IDprocess = '" & Mainform!IDnr & "' AND
IDintstru = '" & Mainform!IDinstr & "'"


Set rst1 = dbs.OpenRecordset(SQL)


If rst1.EOF Then

MsgBox ("Error:.. Identification Number not valid")
Me.IDnr.SetFocus

Set rst1 = Nothing
Set dbs = Nothing
Exit Sub

End If


If subform![Calib Type].Value = "No apply" Then
subform!Calcycle.Enabled = False
subform!Department.Enabled = False
subform![Calibration expr].Enabled = False

Exit Sub
End If


Me!Calcycle.Enabled = True
Me!Department.Enabled = True
Me![Calibration expr].Enabled = True

Me!Calcycle = rst1("Calibration Cycle")


If Me!Calcycle = "1 year" Then
Me![Calibration expr] = DateAdd("yyyy", 1, [Last Calibration])
End If
If Me!Calcycle = "2 years" Then
Me![Calibration expr] = DateAdd("yyyy", 2, [Last Calibration])
End If
If Me!Calcycle = "3 years" Then
Me![Calibration expr] = DateAdd("yyyy", 3, [Last Calibration])
End If
If Me!Calcycle = "5 years" Then
Me![Calibration expr] = DateAdd("yyyy", 5, [Last Calibration])
End If
If Me!Calcycle = "6 months" Then
Me![Calibration expr] = DateAdd("m", 6, [Last Calibration])
End If
If Me!Calcycle = "9 months" Then
Me![Calibration expr] = DateAdd("m", 9, [Last Calibration])
End If

rst1.Close
Set rst1 = Nothing
Set rst = Nothing
Set db = Nothing

--
Message posted via http://www.accessmonster.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching subform(Datasheet) to a subform(Single Form) mewins Microsoft Access Form Coding 1 29th Jun 2009 07:59 PM
datasheet subform Souris Microsoft Access Form Coding 2 1st Apr 2008 07:38 PM
Subform Issue: Datasheet fields display #Deleted upon subform focus jeffcunn@gmail.com Microsoft Access Form Coding 4 22nd Feb 2007 09:48 PM
Subform Datasheet =?Utf-8?B?VGltVA==?= Microsoft Access Forms 2 10th Nov 2005 12:34 AM
how to click a subform (datasheet view) to open another subform =?Utf-8?B?SmVmZg==?= Microsoft Access Forms 1 6th Apr 2005 12:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:15 PM.