|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to gather information from a Form using a concatenated fieldname
Hi,
I am trying to use an array and an 'if 'statement to cycle through a timesheet entry in an Access form, to then use each type of entry as a new row in the table it is to update. The array contains all the types of work possible, eg. Array("abc","def","ghi"...), this text is then used to define the form field I wish to update into the table eg. .Fields("Monday") = "txt" & (Array) & "Mon" where txtABCMon is the text box field name in the form. What is happening is that a type mismatch is occurring due to the concatenation not finding the value int he form, but rather trying to update the table with the literal text. A numeric table field is trying to be amended with txtABCMon, when what is required is the numeric value entered in the form's text box txtABCMon. Apologies if this is confusing, but I have been working on this all afternoon and confused myself too i think! Thanks in advance. |
|
#2
|
|||
|
|||
|
Try something like this
Dim strCtl As String Dim ctl As Control strCtl = "txt" & (Array) & "Mon" For Each ctl In Me.Form.Controls If ctl.Name = strCtl Then With rs .AddNew rs!Monday = ctl.Value .UpDate End With End If Next Above assumes you already have the recordset created of the table to update. But something along those lines should give you a start. lwells |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > How to gather information from a Form using a concatenated fieldname |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|